Add GNU likely/unlikely support
This commit is contained in:
parent
4ce9068963
commit
cd430968ef
1 changed files with 7 additions and 0 deletions
|
@ -13,6 +13,13 @@
|
||||||
#include "slug.h"
|
#include "slug.h"
|
||||||
#include "zmalloc.h"
|
#include "zmalloc.h"
|
||||||
|
|
||||||
|
#ifdef __GNUC__
|
||||||
|
# define likely(x) __builtin_expect(!!(x), 1)
|
||||||
|
# define unlikely(x) __builtin_expect(!!(x), 0)
|
||||||
|
#else
|
||||||
|
# define likely(x) !!(x)
|
||||||
|
# define unlikely(x) !!(x)
|
||||||
|
#endif
|
||||||
|
|
||||||
#define CHECK_PTR(ptr) if (ptr == NULL) return NULL;
|
#define CHECK_PTR(ptr) if (ptr == NULL) return NULL;
|
||||||
|
|
||||||
|
|
Loading…
Reference in a new issue