summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
-rw-r--r--macros.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/macros.h b/macros.h
index 04e2046..3b26976 100644
--- a/macros.h
+++ b/macros.h
@@ -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)))