]> git.ozlabs.org Git - ccan/blob - ccan/alignof/alignof.h
tdb2: reduce transaction before writing to recovery area.
[ccan] / ccan / alignof / alignof.h
1 #ifndef CCAN_ALIGNOF_H
2 #define CCAN_ALIGNOF_H
3 #include "config.h"
4
5 /**
6  * ALIGNOF - get the alignment of a type
7  * @t: the type to test
8  *
9  * This returns a safe alignment for the given type.
10  */
11 #if HAVE_ALIGNOF
12 /* A GCC extension. */
13 #define ALIGNOF(t) __alignof__(t)
14 #else
15 /* Alignment by measuring structure padding. */
16 #define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0)
17 #endif
18
19 #endif /* CCAN_ALIGNOF_H */