Go to the documentation of this file.
10 #ifndef OPENOCD_HELPER_ALIGN_H
11 #define OPENOCD_HELPER_ALIGN_H
13 #define ALIGN_MASK(x, mask) \
15 typeof(mask) _mask = (mask); \
16 ((x) + _mask) & ~_mask; \
20 #define ALIGN_UP(x, a) ALIGN_MASK(x, (typeof(x))(a) - 1)
21 #define ALIGN_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1))
22 #define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)
24 #define IS_PWR_OF_2(x) \
27 _x == 0 || (_x & (_x - 1)) == 0; \