diff --git a/common/util.h b/common/util.h index 466e077bf..deeb16817 100644 --- a/common/util.h +++ b/common/util.h @@ -26,6 +26,7 @@ #include #include #include +#include /** 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)