Support branch prediction helpers on clang compiles (#491)
This commit is contained in:
parent
7dba30639a
commit
76c4873e8c
|
@ -74,10 +74,9 @@ extern "C" void hb_free_impl(void *ptr);
|
||||||
/* Compiler attributes */
|
/* Compiler attributes */
|
||||||
|
|
||||||
|
|
||||||
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
|
#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
|
||||||
#define _HB_BOOLEAN_EXPR(expr) ((expr) ? 1 : 0)
|
#define likely(expr) (__builtin_expect (!!(expr), 1))
|
||||||
#define likely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 1))
|
#define unlikely(expr) (__builtin_expect (!!(expr), 0))
|
||||||
#define unlikely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 0))
|
|
||||||
#else
|
#else
|
||||||
#define likely(expr) (expr)
|
#define likely(expr) (expr)
|
||||||
#define unlikely(expr) (expr)
|
#define unlikely(expr) (expr)
|
||||||
|
|
Loading…
Reference in New Issue