15 lines
345 B
C
15 lines
345 B
C
#ifndef UTIL_H
|
|
#define UTIL_H
|
|
|
|
/*
|
|
* Give hints to the compiler for branch prediction optimization.
|
|
*/
|
|
#if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
|
|
#define likely(c) (__builtin_expect(!!(c), 1))
|
|
#define unlikely(c) (__builtin_expect(!!(c), 0))
|
|
#else
|
|
#define likely(c) (c)
|
|
#define unlikely(c) (c)
|
|
#endif
|
|
|
|
#endif // UTIL_H
|