add {un,}likely macros

Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
Pierre Habouzit 2008-06-22 14:57:29 +02:00
parent ea646e7077
commit 848a0b1987
1 changed files with 7 additions and 0 deletions

View File

@ -26,6 +26,7 @@
#include <string.h>
#include <stdlib.h>
#include <stdbool.h>
#include <stdarg.h>
/** A list of possible position, not sex related */
typedef enum
@ -91,6 +92,9 @@ typedef struct
*__ptr = NULL; \
} while(0)
#define likely(expr) __builtin_expect(!!(expr), 1)
#define unlikely(expr) __builtin_expect((expr), 0)
#else
#define p_delete(mem_p) \
@ -100,6 +104,9 @@ typedef struct
*(void **)__ptr = NULL; \
} while (0)
#define likely(expr) expr
#define unlikely(expr) expr
#endif
static inline void * __attribute__ ((malloc)) xmalloc(ssize_t size)