Bug 792689 - Add some double negations to the macros in Likely.h; r=Waldo
authorMs2ger <ms2ger@gmail.com>
Thu, 20 Sep 2012 13:17:05 +0200
changeset 107811 7ffcbd67d18d72b45380f0cc3a48123bbe8f85a5
parent 107810 190cd1d48a945376cb996129f02a5703a7b2bef1
child 107812 eed7b92769c36585304e3c8eb3d80315f66d315d
push id82
push usershu@rfrn.org
push dateFri, 05 Oct 2012 13:20:22 +0000
reviewersWaldo
bugs792689
milestone18.0a1
Bug 792689 - Add some double negations to the macros in Likely.h; r=Waldo
mfbt/Likely.h
--- a/mfbt/Likely.h
+++ b/mfbt/Likely.h
@@ -7,16 +7,16 @@
  * MOZ_LIKELY and MOZ_UNLIKELY macros to hint to the compiler how a
  * boolean predicate should be branch-predicted.
  */
 
 #ifndef mozilla_Likely_h_
 #define mozilla_Likely_h_
 
 #if defined(__clang__) || (defined(__GNUC__) && (__GNUC__ > 2))
-#  define MOZ_LIKELY(x)   (__builtin_expect((x), 1))
-#  define MOZ_UNLIKELY(x) (__builtin_expect((x), 0))
+#  define MOZ_LIKELY(x)   (__builtin_expect(!!(x), 1))
+#  define MOZ_UNLIKELY(x) (__builtin_expect(!!(x), 0))
 #else
-#  define MOZ_LIKELY(x)   (x)
-#  define MOZ_UNLIKELY(x) (x)
+#  define MOZ_LIKELY(x)   (!!(x))
+#  define MOZ_UNLIKELY(x) (!!(x))
 #endif
 
 #endif /* mozilla_Likely_h_ */