From 9c70f4c97670ec60448224b1007e706ba75d9077 Mon Sep 17 00:00:00 2001 From: Doug Nazar Date: Sun, 18 Aug 2019 11:50:44 -0400 Subject: [PATCH] orc: Add ORC_LIKELY/ORC_UNLIKELY macros --- orc/orcutils.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/orc/orcutils.h b/orc/orcutils.h index dc13cd0..59c2c9e 100644 --- a/orc/orcutils.h +++ b/orc/orcutils.h @@ -167,6 +167,14 @@ typedef unsigned int orc_bool; #define ORC_GNUC_PREREQ(maj, min) 0 #endif +#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) +#define ORC_LIKELY(expr) (__builtin_expect ((expr), 1)) +#define ORC_UNLIKELY(expr) (__builtin_expect ((expr), 0)) +#else +#define ORC_LIKELY(expr) (expr) +#define ORC_UNLIKELY(expr) (expr) +#endif + #ifndef ORC_INTERNAL #if defined(__SUNPRO_C) && (__SUNPRO_C >= 0x590) #define ORC_INTERNAL __attribute__((visibility("hidden"))) -- 2.7.4