[HarfBuzz] harfbuzz: Branch 'master'

Behdad Esfahbod behdad at kemper.freedesktop.org
Fri Jun 2 17:24:20 UTC 2017


 src/hb-private.hh |    7 +++----
 1 file changed, 3 insertions(+), 4 deletions(-)

New commits:
commit 76c4873e8cad2871d2d547318d371b9a89d8c806
Author: Ebrahim Byagowi <ebrahim at gnu.org>
Date:   Fri Jun 2 21:53:10 2017 +0430

    Support branch prediction helpers on clang compiles (#491)

diff --git a/src/hb-private.hh b/src/hb-private.hh
index 3595edee..b5dccc55 100644
--- a/src/hb-private.hh
+++ b/src/hb-private.hh
@@ -74,10 +74,9 @@ extern "C" void  hb_free_impl(void *ptr);
 /* Compiler attributes */
 
 
-#if defined(__GNUC__) && (__GNUC__ > 2) && defined(__OPTIMIZE__)
-#define _HB_BOOLEAN_EXPR(expr) ((expr) ? 1 : 0)
-#define likely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 1))
-#define unlikely(expr) (__builtin_expect (_HB_BOOLEAN_EXPR(expr), 0))
+#if (defined(__GNUC__) || defined(__clang__)) && defined(__OPTIMIZE__)
+#define likely(expr) (__builtin_expect (!!(expr), 1))
+#define unlikely(expr) (__builtin_expect (!!(expr), 0))
 #else
 #define likely(expr) (expr)
 #define unlikely(expr) (expr)


More information about the HarfBuzz mailing list