Simplify likely() implementation

Shrinks .text by 1%!
This commit is contained in:
Behdad Esfahbod 2010-05-10 23:50:07 -04:00
parent 75651b2087
commit 494d28ad98
1 changed files with 1 additions and 9 deletions

View File

@ -85,15 +85,7 @@
#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__) #if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
#define _HB_BOOLEAN_EXPR(expr) \ #define _HB_BOOLEAN_EXPR(expr) ((expr) ? 1 : 0)
__extension__ ({ \
int _hb_boolean_var_; \
if (expr) \
_hb_boolean_var_ = 1; \
else \
_hb_boolean_var_ = 0; \
_hb_boolean_var_; \
})
#define likely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 1)) #define likely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 1))
#define unlikely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 0)) #define unlikely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 0))
#else #else