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 107588 6a2d1a3556b94d4bac0d0283dfe6152110d7af79
parent 107587 2f53d8795b489a054a654b8c12b37487457b03a7
child 107589 7748dba7f579a800e4420dfbe29ce33311bd9412
child 107631 8656e7a77c0ec61a9ca40e92929be8634bcc875c
push id1100
push userdcamp@campd.org
push dateThu, 20 Sep 2012 22:53:07 +0000
treeherderfx-team@f731fa718465 [default view] [failures only]
perfherder[talos] [build metrics] [platform microbench] (compared to previous push)
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_ */