misc: Add parentheses around ALIGN_UP() and ALIGN_DOWN() arguments

This ensures that expected order of operations is preserved when arguments
are expressions.

Signed-off-by: Glenn Washburn <development@efficientek.com>
Reviewed-by: Patrick Steinhardt <ps@pks.im>
Reviewed-by: Daniel Kiper <daniel.kiper@oracle.com>
This commit is contained in:
Glenn Washburn authored and Daniel Kiper committed 2020-12-12 01:19:04 +01:00
1 parent 880dfd8f40
commit 8e8b2316ac
1 file changed
+2 -2
+2 -2
View File
@@ -28,10 +28,10 @@
#include <grub/compiler.h> #include <grub/compiler.h>
#define ALIGN_UP(addr, align) \ #define ALIGN_UP(addr, align) \
((addr + (typeof (addr)) align - 1) & ~((typeof (addr)) align - 1)) (((addr) + (typeof (addr)) (align) - 1) & ~((typeof (addr)) (align) - 1))
#define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) - 1)) #define ALIGN_UP_OVERHEAD(addr, align) ((-(addr)) & ((typeof (addr)) (align) - 1))
#define ALIGN_DOWN(addr, align) \ #define ALIGN_DOWN(addr, align) \
((addr) & ~((typeof (addr)) align - 1)) ((addr) & ~((typeof (addr)) (align) - 1))
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0])) #define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; } #define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }