diff options
author | Richard Braun <rbraun@sceen.net> | 2017-06-25 17:49:55 +0200 |
---|---|---|
committer | Richard Braun <rbraun@sceen.net> | 2017-06-25 17:49:55 +0200 |
commit | 9283065587c674e5f46bccc3406cd128570a14dc (patch) | |
tree | 450ea7ea397886a4e1a3219add6c3bdba8e4848a /macros.h | |
parent | 73b44d2c58018352ebe4b280431d4cdfd0019c1e (diff) |
macros: add comments to power-of-two alignment macros
Diffstat (limited to 'macros.h')
-rw-r--r-- | macros.h | 6 |
1 files changed, 3 insertions, 3 deletions
@@ -54,9 +54,9 @@ #define P2ALIGNED(x, a) (((x) & ((a) - 1)) == 0) #define ISP2(x) P2ALIGNED(x, x) -#define P2ALIGN(x, a) ((x) & -(a)) -#define P2ROUND(x, a) (-(-(x) & -(a))) -#define P2END(x, a) (-(~(x) & -(a))) +#define P2ALIGN(x, a) ((x) & -(a)) /* decreases if not aligned */ +#define P2ROUND(x, a) (-(-(x) & -(a))) /* increases if not aligned */ +#define P2END(x, a) (-(~(x) & -(a))) /* always increases */ #define structof(ptr, type, member) \ ((type *)((char *)(ptr) - offsetof(type, member))) |