From ef9d9423cc008794eb5e005127365d6dd8000758 Mon Sep 17 00:00:00 2001 From: nobu Date: Wed, 29 Jul 2015 02:13:00 +0000 Subject: internal.h: ensure a boolean * internal.h (LIKELY, UNLIKELY): make a boolean to enforce 1 or 0. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@51420 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- ChangeLog | 4 ++++ internal.h | 4 ++-- 2 files changed, 6 insertions(+), 2 deletions(-) diff --git a/ChangeLog b/ChangeLog index 210287c3ff..8462bd171c 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Wed Jul 29 11:07:10 2015 Nobuyoshi Nakada + + * internal.h (LIKELY, UNLIKELY): make a boolean to enforce 1 or 0. + Wed Jul 29 10:44:43 2015 Alex Dowad * gc.c: document argument passed to finalizer proc. diff --git a/internal.h b/internal.h index 58ff89763c..a9b3ee4824 100644 --- a/internal.h +++ b/internal.h @@ -25,8 +25,8 @@ extern "C" { /* likely */ #if __GNUC__ >= 3 -#define LIKELY(x) (__builtin_expect((x), 1)) -#define UNLIKELY(x) (__builtin_expect((x), 0)) +#define LIKELY(x) (__builtin_expect(!(x), 0)) +#define UNLIKELY(x) (__builtin_expect(!(x), 1)) #else /* __GNUC__ >= 3 */ #define LIKELY(x) (x) #define UNLIKELY(x) (x) -- cgit v1.2.3