From 2fdee490745a6c3a75691907aadf8ae38c57234c Mon Sep 17 00:00:00 2001 From: Chris Wilson Date: Mon, 17 Nov 2008 12:22:39 +0000 Subject: [PATCH] [compiler] likelihood macros Behdad prefers these to be upper-case to be consistent with G_UNLIKELY and friends. However, as I intend to use these for nearly all instances of if(status), I suggest that we keep to the short and not so loud: if (unlikely (status)) return status; --- src/cairo-compiler-private.h | 8 ++++---- src/cairo-hash.c | 2 +- 2 files changed, 5 insertions(+), 5 deletions(-) diff --git a/src/cairo-compiler-private.h b/src/cairo-compiler-private.h index 76b8e8014..44d9de308 100644 --- a/src/cairo-compiler-private.h +++ b/src/cairo-compiler-private.h @@ -149,11 +149,11 @@ _cairo_boolean_var_ = 0; \ _cairo_boolean_var_; \ }) -#define _cairo_likely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 1)) -#define _cairo_unlikely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 0)) +#define likely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 1)) +#define unlikely(expr) (__builtin_expect (_CAIRO_BOOLEAN_EXPR(expr), 0)) #else -#define _cairo_likely(expr) (expr) -#define _cairo_unlikely(expr) (expr) +#define likely(expr) (expr) +#define unlikely(expr) (expr) #endif #ifndef __GNUC__ diff --git a/src/cairo-hash.c b/src/cairo-hash.c index 78ea56bcb..b3f43b05e 100644 --- a/src/cairo-hash.c +++ b/src/cairo-hash.c @@ -434,7 +434,7 @@ _cairo_hash_table_insert (cairo_hash_table_t *hash_table, hash_table->live_entries++; status = _cairo_hash_table_resize (hash_table); - if (_cairo_unlikely (status)) { + if (unlikely (status)) { /* abort the insert... */ hash_table->live_entries--; return status;