blob: 9a02f188a839271294c79955e0a22cab154aad8e (
plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
|
/* CC0 (Public domain) - see LICENSE file for details */
#ifndef CCAN_ALIGNOF_H
#define CCAN_ALIGNOF_H
#include "config.h"
/**
* ALIGNOF - get the alignment of a type
* @t: the type to test
*
* This returns a safe alignment for the given type.
*/
#if HAVE_ALIGNOF
/* A GCC extension. */
#define ALIGNOF(t) __alignof__(t)
#else
/* Alignment by measuring structure padding. */
#define ALIGNOF(t) ((char *)(&((struct { char c; t _h; } *)0)->_h) - (char *)0)
#endif
#endif /* CCAN_ALIGNOF_H */
|