add {un,}likely macros
Signed-off-by: Pierre Habouzit <madcoder@debian.org>
This commit is contained in:
parent
ea646e7077
commit
848a0b1987
|
@ -26,6 +26,7 @@
|
||||||
#include <string.h>
|
#include <string.h>
|
||||||
#include <stdlib.h>
|
#include <stdlib.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
#include <stdarg.h>
|
||||||
|
|
||||||
/** A list of possible position, not sex related */
|
/** A list of possible position, not sex related */
|
||||||
typedef enum
|
typedef enum
|
||||||
|
@ -91,6 +92,9 @@ typedef struct
|
||||||
*__ptr = NULL; \
|
*__ptr = NULL; \
|
||||||
} while(0)
|
} while(0)
|
||||||
|
|
||||||
|
#define likely(expr) __builtin_expect(!!(expr), 1)
|
||||||
|
#define unlikely(expr) __builtin_expect((expr), 0)
|
||||||
|
|
||||||
#else
|
#else
|
||||||
|
|
||||||
#define p_delete(mem_p) \
|
#define p_delete(mem_p) \
|
||||||
|
@ -100,6 +104,9 @@ typedef struct
|
||||||
*(void **)__ptr = NULL; \
|
*(void **)__ptr = NULL; \
|
||||||
} while (0)
|
} while (0)
|
||||||
|
|
||||||
|
#define likely(expr) expr
|
||||||
|
#define unlikely(expr) expr
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
static inline void * __attribute__ ((malloc)) xmalloc(ssize_t size)
|
static inline void * __attribute__ ((malloc)) xmalloc(ssize_t size)
|
||||||
|
|
Loading…
Reference in New Issue