aboutsummaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-29 02:13:00 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-07-29 02:13:00 +0000
commitef9d9423cc008794eb5e005127365d6dd8000758 (patch)
treeaab06a38bf624269ce06da937aec84b6be943ebf
parent53e301a2d804919341b7012d58686edab5386116 (diff)
downloadruby-ef9d9423cc008794eb5e005127365d6dd8000758.tar.gz
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
-rw-r--r--ChangeLog4
-rw-r--r--internal.h4
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 <nobu@ruby-lang.org>
+
+ * internal.h (LIKELY, UNLIKELY): make a boolean to enforce 1 or 0.
+
Wed Jul 29 10:44:43 2015 Alex Dowad <alexinbeijing@gmail.com>
* 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)