summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--lib/ccan/likely/likely.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/lib/ccan/likely/likely.h b/lib/ccan/likely/likely.h
index c43d276759..3a9c6d4640 100644
--- a/lib/ccan/likely/likely.h
+++ b/lib/ccan/likely/likely.h
@@ -30,7 +30,9 @@
* return false;
* }
*/
+#ifndef likely
#define likely(cond) __builtin_expect(!!(cond), 1)
+#endif
/**
* unlikely - indicate that a condition is unlikely to be true.
@@ -51,11 +53,17 @@
* fprintf(stderr, "Overflow!");
* }
*/
+#ifndef unlikely
#define unlikely(cond) __builtin_expect(!!(cond), 0)
+#endif
#else
+#ifndef likely
#define likely(cond) (!!(cond))
+#endif
+#ifndef unlikely
#define unlikely(cond) (!!(cond))
#endif
+#endif
#else /* CCAN_LIKELY_DEBUG versions */
#define likely(cond) \
(_likely_trace(!!(cond), 1, stringify(cond), __FILE__, __LINE__))