]> www.ginac.de Git - cln.git/blob - src/base/cl_offsetof.h
319233448d0ff62439f4831b3d57682ed1cb677f
[cln.git] / src / base / cl_offsetof.h
1 // offsetof() and friends
2
3 #ifndef _CL_OFFSETOF_H
4 #define _CL_OFFSETOF_H
5
6 #undef offsetof
7 #if defined(__GNUG__)
8   #define offsetof(type,ident)  ((long)&(((type*)1)->ident)-1)
9 #else
10   #define offsetof(type,ident)  ((long)&(((type*)0)->ident))
11 #endif
12 #define offsetofa(type,ident)  offsetof(type,ident[0])
13
14 #endif /* _CL_OFFSETOF_H */