diff options
| author | Peter Jones <pjones@redhat.com> | 2024-06-27 15:16:18 -0400 |
|---|---|---|
| committer | Peter Jones <pjones@redhat.com> | 2025-02-24 15:22:28 -0500 |
| commit | 765f2944fb392be2e8f76f3503ae7ceab301fea4 (patch) | |
| tree | a9935365d0c855752f435de5cb354b86bca7cdff | |
| parent | 1294b47a00185de282ac127e48039178b70ae4f4 (diff) | |
| download | efi-boot-shim-765f2944fb392be2e8f76f3503ae7ceab301fea4.tar.gz efi-boot-shim-765f2944fb392be2e8f76f3503ae7ceab301fea4.zip | |
compiler.h: minor ALIGN_... fixes
This fixes some minor errors with the testing of how ALIGN() and similar
are defined, and makes an explicit "ALIGN_UP()" macro to complement the
existing ALIGN_DOWN() macro.
Signed-off-by: Peter Jones <pjones@redhat.com>
| -rw-r--r-- | include/compiler.h | 7 |
1 files changed, 6 insertions, 1 deletions
diff --git a/include/compiler.h b/include/compiler.h index 982bc235..6a19217c 100644 --- a/include/compiler.h +++ b/include/compiler.h @@ -175,14 +175,19 @@ #define BUILD_BUG_ON_MSG(cond, msg) compiletime_assert(!(cond), msg) #endif -#ifndef ALIGN +#ifndef __ALIGN #define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask)) #define __ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1) +#endif +#ifndef ALIGN #define ALIGN(x, a) __ALIGN((x), (a)) #endif #ifndef ALIGN_DOWN #define ALIGN_DOWN(x, a) __ALIGN((x) - ((a) - 1), (a)) #endif +#ifndef ALIGN_UP +#define ALIGN_UP(addr, align) (((addr) + (typeof (addr)) (align) - 1) & ~((typeof (addr)) (align) - 1)) +#endif #define MIN(a, b) ({(a) < (b) ? (a) : (b);}) #define MAX(a, b) ({(a) <= (b) ? (b) : (a);}) |
