diff options
Diffstat (limited to 'misc.h')
-rw-r--r-- | misc.h | 9 |
1 files changed, 9 insertions, 0 deletions
@@ -0,0 +1,9 @@ +/* + * misc useful #defines ... + */ + +#define container_of(ptr, type, member) ({ \ + const typeof( ((type *)0)->member ) *__mptr = (ptr); \ + (type *)( (char *)__mptr - offsetof(type,member) );}) + +#define array_size(x) (sizeof(x)/sizeof(x[0])) |