summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorAndrei Karas <akaras@inbox.ru>2016-07-14 18:58:34 +0300
committerAndrei Karas <akaras@inbox.ru>2016-07-14 18:58:34 +0300
commitcf71ad5db541cba69d9214aa4df5752d8c7eec80 (patch)
tree322f1bfea6947ddfa8c50ee930b93bdbad447214
parent142ff23dba038330b724372be3653f62ecd979e4 (diff)
downloadmanaplus-cf71ad5db541cba69d9214aa4df5752d8c7eec80.tar.gz
manaplus-cf71ad5db541cba69d9214aa4df5752d8c7eec80.tar.bz2
manaplus-cf71ad5db541cba69d9214aa4df5752d8c7eec80.tar.xz
manaplus-cf71ad5db541cba69d9214aa4df5752d8c7eec80.zip
Add branch prediction macroses for gcc.
-rw-r--r--src/localconsts.h8
1 files changed, 8 insertions, 0 deletions
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(), \