diff options
Diffstat (limited to 'include/ruby/ruby.h')
-rw-r--r-- | include/ruby/ruby.h | 9 |
1 files changed, 9 insertions, 0 deletions
diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 5c942c95ce..71a91b558f 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -62,6 +62,15 @@ extern "C" { # define UNREACHABLE ((void)0) /* unreachable */ #endif +/* likely */ +#if __GNUC__ >= 3 +#define LIKELY(x) (__builtin_expect(!!(x), 1)) +#define UNLIKELY(x) (__builtin_expect(!!(x), 0)) +#else /* __GNUC__ >= 3 */ +#define LIKELY(x) (x) +#define UNLIKELY(x) (x) +#endif /* __GNUC__ >= 3 */ + #ifdef __GNUC__ #define PRINTF_ARGS(decl, string_index, first_to_check) \ decl __attribute__((format(printf, string_index, first_to_check))) |