fix macros to be defined only if they already do not exist

parent 9ab02ef4
......@@ -55,25 +55,38 @@
#ifdef __GNUC__
#ifndef likely
# define likely(x) __builtin_expect(!!(x), 1)
#endif
#ifndef unlikely
# define unlikely(x) __builtin_expect(!!(x), 0)
#endif
#if __GNUC__ >= 9
# define equally_likely(x) __builtin_expect_with_probability(!!(x),0,0.5)
#else
# define equally_likely(x) (x)
#endif
#ifndef prefetch
# define prefetch(...) __builtin_prefetch(__VA_ARGS__)
#endif
# if __GNUC__ >=4
# define MAYBE_UNUSED __attribute__ ((unused))
# endif
#else // __GNUC__
#ifndef likely
#define likely(x) (x)
#endif
#ifndef unlikely
#define unlikely(x) (x)
#endif
#ifndef equally_likely
#define equally_likely(x) (x)
#endif
#ifndef prefetch
#define prefetch(...) /* prefetch: do nothing */
#endif
#endif // __GNUC__
......
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