Android-x86
Fork
Donation

  • R/O
  • HTTP
  • SSH
  • HTTPS

external-efivar: 提交

external/efivar


Commit MetaInfo

修订版cb0b1c30103abc17dbbed14210bbc59a73802206 (tree)
时间2019-01-08 00:30:23
作者Peter Jones <pjones@redh...>
CommiterPeter Jones

Log Message

util.h: add unlikely() and likely() macros

Signed-off-by: Peter Jones <pjones@redhat.com>

更改概述

差异

--- a/src/util.h
+++ b/src/util.h
@@ -52,6 +52,15 @@
5252 #define PACKED __attribute__((__packed__))
5353 #define VERSION(sym, ver) __asm__(".symver " # sym "," # ver)
5454
55+#define __branch_check__(x, expect, is_constant) \
56+ __builtin_expect(!!(x), expect)
57+#ifndef likely
58+#define likely(x) (__branch_check__(x, 1, __builtin_constant_p(x)))
59+#endif
60+#ifndef unlikely
61+#define unlikely(x) (__branch_check__(x, 0, __builtin_constant_p(x)))
62+#endif
63+
5564 /*
5665 * I'm not actually sure when these appear, but they're present in the
5766 * version in front of me.
Show on old repository browser