doc
Macros
c_macro.h File Reference
#include <stdint.h>
#include <string.h>

Go to the source code of this file.

Macros

#define ARRAY_SIZE(a)   (sizeof(a)/sizeof(a[0]))
 
#define discard_const(ptr)   ((void *)((uintptr_t)(ptr)))
 
#define discard_const_p(type, ptr)   ((type *)discard_const(ptr))
 
#define INT_TO_POINTER(i)   (void *) i
 
#define likely(x)   (x)
 
#define MAX(a, b)   ((a) < (b) ? (b) : (a))
 
#define MIN(a, b)   ((a) < (b) ? (a) : (b))
 
#define POINTER_TO_INT(p)   *((int *) (p))
 
#define SAFE_FREE(x)   do { if ((x) != NULL) {free(x); x=NULL;} } while(0)
 
#define unlikely(x)   (x)
 
#define ZERO_STRUCT(x)   memset((char *)&(x), 0, sizeof(x))
 
#define ZERO_STRUCTP(x)   do { if ((x) != NULL) memset((char *)(x), 0, sizeof(*(x))); } while(0)
 

Detailed Description

cynapses libc macro definitions

Definition in file c_macro.h.