From cf71ad5db541cba69d9214aa4df5752d8c7eec80 Mon Sep 17 00:00:00 2001 From: Andrei Karas Date: Thu, 14 Jul 2016 18:58:34 +0300 Subject: Add branch prediction macroses for gcc. --- src/localconsts.h | 8 ++++++++ 1 file changed, 8 insertions(+) diff --git a/src/localconsts.h b/src/localconsts.h index af97ff723..12c14a5e7 100644 --- a/src/localconsts.h +++ b/src/localconsts.h @@ -223,6 +223,14 @@ #endif // ENABLE_CILKPLUS #endif // __GNUC__ +#ifdef __GNUC__ +#define A_LIKELY(x) __builtin_expect (!!(x), 1) +#define A_UNLIKELY(x) __builtin_expect (!!(x), 0) +#else // __GNUC__ +#define A_LIKELY(x) (x) +#define A_UNLIKELY(x) (x) +#endif // __GNUC__ + #define notfinal #define FOR_EACH(type, iter, array) for (type iter = array.begin(), \ -- cgit v1.2.3-60-g2f50