mirror of
https://gitlab.freedesktop.org/cairo/cairo.git
synced 2026-05-09 04:58:04 +02:00
[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:
parent
97edc680c1
commit
2fdee49074
2 changed files with 5 additions and 5 deletions
|
|
@ -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__
|
||||
|
|
|
|||
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue