aboutsummaryrefslogtreecommitdiffstats
path: root/misc.h
blob: 92a66bc464adfb321c246166fe0b312020480673 (plain)
1
2
3
4
5
6
7
8
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]))