Go to the documentation of this file.
37#define INT_TO_POINTER(i) (void *) i
38#define POINTER_TO_INT(p) *((int *) (p))
41#define ZERO_STRUCT(x) memset((char *)&(x), 0, sizeof(x))
44#define ZERO_STRUCTP(x) do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
47#define SAFE_FREE(x) do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
50#define MIN(a,b) ((a) < (b) ? (a) : (b))
53#define MAX(a,b) ((a) < (b) ? (b) : (a))
56#define ARRAY_SIZE(a) (sizeof(a)/sizeof(a[0]))
70#define discard_const(ptr) ((void *)((uintptr_t)(ptr)))
75#define discard_const_p(type, ptr) ((type *)discard_const(ptr))
79# define likely(x) __builtin_expect(!!(x), 1)
82# define unlikely(x) __builtin_expect(!!(x), 0)
89# define unlikely(x) (x)