]> git.itanic.dy.fi Git - log-plotter/blob - utils.h
data.c: Store cell count and system status into variable array
[log-plotter] / utils.h
1 #ifndef _UTILS_H
2 #define _UTILS_H
3
4 #define ARRAY_SIZE(x) (sizeof(x) / sizeof((x)[0]))
5
6 #ifndef offsetof
7 #define offsetof(type, member)  __builtin_offsetof (type, member)
8 #endif
9
10 #define container_of(ptr, type, member) \
11         ({                                                              \
12                 const typeof( ((type *)0)->member ) *__mptr = (ptr);    \
13                 (type *)( (char *)__mptr - offsetof(type,member) );     \
14         })
15
16 #endif