Revision ac509d88 osdep.h
b/osdep.h | ||
---|---|---|
23 | 23 |
#define unlikely(x) __builtin_expect(!!(x), 0) |
24 | 24 |
#endif |
25 | 25 |
|
26 |
#ifndef offsetof |
|
27 |
#define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *) 0)->MEMBER) |
|
28 |
#endif |
|
29 |
#ifndef container_of |
|
26 | 30 |
#define container_of(ptr, type, member) ({ \ |
27 |
const typeof( ((type *)0)->member ) *__mptr = (ptr); \ |
|
28 |
(type *)( (char *)__mptr - offsetof(type,member) );}) |
|
31 |
const typeof(((type *) 0)->member) *__mptr = (ptr); \ |
|
32 |
(type *) ((char *) __mptr - offsetof(type, member));}) |
|
33 |
#endif |
|
29 | 34 |
|
30 | 35 |
#ifndef MIN |
31 | 36 |
#define MIN(a, b) (((a) < (b)) ? (a) : (b)) |
Also available in: Unified diff