mirror of
https://git.proxmox.com/git/grub2
synced 2025-08-03 06:14:28 +00:00
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:
parent
880dfd8f40
commit
8e8b2316ac
@ -28,10 +28,10 @@
|
||||
#include <grub/compiler.h>
|
||||
|
||||
#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_DOWN(addr, align) \
|
||||
((addr) & ~((typeof (addr)) align - 1))
|
||||
((addr) & ~((typeof (addr)) (align) - 1))
|
||||
#define ARRAY_SIZE(array) (sizeof (array) / sizeof (array[0]))
|
||||
#define COMPILE_TIME_ASSERT(cond) switch (0) { case 1: case !(cond): ; }
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user