Commit 665c4ff7 authored by Dominik Charousset's avatar Dominik Charousset Committed by Dominik Charousset

Add likely/unlikely macros for branching

parent 8139a6ed
......@@ -62,6 +62,8 @@
// CAF_PUSH_WARNINGS and CAF_POP_WARNINGS
#if defined(__clang__)
# define CAF_CLANG
# define CAF_LIKELY(x) __builtin_expect((x), 1)
# define CAF_UNLIKELY(x) __builtin_expect((x), 0)
# define CAF_DEPRECATED __attribute__((deprecated))
# define CAF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
# define CAF_PUSH_WARNINGS \
......@@ -104,6 +106,8 @@
# endif
#elif defined(__GNUC__)
# define CAF_GCC
# define CAF_LIKELY(x) __builtin_expect((x), 1)
# define CAF_UNLIKELY(x) __builtin_expect((x), 0)
# define CAF_DEPRECATED __attribute__((deprecated))
# define CAF_DEPRECATED_MSG(msg) __attribute__((deprecated(msg)))
# define CAF_PUSH_WARNINGS
......@@ -130,6 +134,8 @@
# endif
#elif defined(_MSC_VER)
# define CAF_MSVC
# define CAF_LIKELY(x) x
# define CAF_UNLIKELY(x) x
# define CAF_DEPRECATED
# define CAF_DEPRECATED_MSG(msg)
# define CAF_PUSH_WARNINGS
......@@ -144,6 +150,8 @@
# define NOMINMAX
# endif // NOMINMAX
#else
# define CAF_LIKELY(x) x
# define CAF_UNLIKELY(x) x
# define CAF_DEPRECATED
# define CAF_PUSH_WARNINGS
# define CAF_POP_WARNINGS
......
Markdown is supported
0%
or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment