[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;
This commit is contained in:
Chris Wilson 2008-11-17 12:22:39 +00:00
parent 97edc680c1
commit 2fdee49074
2 changed files with 5 additions and 5 deletions

View file

@ -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__

View file

@ -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;