aboutsummaryrefslogtreecommitdiff
path: root/stdlib/util.h
diff options
context:
space:
mode:
Diffstat (limited to 'stdlib/util.h')
-rw-r--r--stdlib/util.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/stdlib/util.h b/stdlib/util.h
index 310ba905..98c087a7 100644
--- a/stdlib/util.h
+++ b/stdlib/util.h
@@ -39,6 +39,14 @@
#define INLINE inline __attribute__ ((always_inline))
#endif
+#ifndef likely
+#define likely(x) (__builtin_expect(!!(x), 1))
+#endif
+
+#ifndef unlikely
+#define unlikely(x) (__builtin_expect(!!(x), 0))
+#endif
+
// GCC lets you define macro-like functions which are always inlined and never
// compiled using this combination of flags. See: https://gcc.gnu.org/onlinedocs/gcc/Inline.html
#ifndef MACROLIKE