diff --git a/src/common/common_funcs.h b/src/common/common_funcs.h index 4633897ce..8d40daded 100644 --- a/src/common/common_funcs.h +++ b/src/common/common_funcs.h @@ -29,6 +29,14 @@ #define FORCE_INLINE inline __attribute__((always_inline)) #endif +#if defined(__GNUC__) + #define likely(x) __builtin_expect(!!(x), 1) + #define unlikely(x) __builtin_expect(!!(x), 0) +#else + #define likely(x) (x) + #define unlikely(x) (x) +#endif + #ifndef _MSC_VER #ifdef ARCHITECTURE_x86_64