1
0
Fork 0
mirror of https://git.rwth-aachen.de/acs/public/villas/node/ synced 2025-03-09 00:00:00 +01:00

added address alignment macros for 'struct pool'

This commit is contained in:
Steffen Vogel 2016-06-08 22:32:37 +02:00
parent 002c6f8d5f
commit 156e30a60d

View file

@ -43,6 +43,12 @@
#define XSTR(x) STR(x)
#define STR(x) #x
#define ALIGN(x, a) ALIGN_MASK(x, (uintptr_t) (a) - 1)
#define ALIGN_MASK(x, m) (((uintptr_t) (x) + (m)) & ~(m))
#define IS_ALIGNED(x, a) (ALIGN(x, a) == (uintptr_t) x)
#define CEIL(x, y) ((x + y - 1) / y)
/** Calculate the number of elements in an array. */
#define ARRAY_LEN(a) ( sizeof (a) / sizeof (a)[0] )