diff options
author | Andrew Bresticker <abrestic@chromium.org> | 2015-02-05 13:27:59 -0800 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-03-20 10:01:22 +0100 |
commit | 19fd0b09eeade2b013f229d726e124fa7eb840f0 (patch) | |
tree | 2ad8a89b64d17a73d5b0691169f02bbd0e5aa3dc | |
parent | 8dd4f98222405b01188c5f80eb08ac97172f58e4 (diff) | |
download | coreboot-19fd0b09eeade2b013f229d726e124fa7eb840f0.tar.xz |
stdlib: Add IS_ALIGNED macro
Add a macro to check if a value is aligned.
BUG=chrome-os-partner:36258
BRANCH=none
TEST=Build and boot on Pistachio.
Change-Id: I0680954eb1b1964a631527f96aa0570a32944fa1
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: 4f1717648e0a4b54217d71f8d0a15d496737d156
Original-Change-Id: Ie0bc1374918a7ffaaec5fea62c1193a42edd416c
Original-Signed-off-by: Andrew Bresticker <abrestic@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/246692
Original-Reviewed-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: http://review.coreboot.org/8757
Tested-by: build bot (Jenkins)
Reviewed-by: Aaron Durbin <adurbin@google.com>
Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net>
-rw-r--r-- | src/include/stdlib.h | 1 |
1 files changed, 1 insertions, 0 deletions
diff --git a/src/include/stdlib.h b/src/include/stdlib.h index 2fc6805c73..35e8b3229a 100644 --- a/src/include/stdlib.h +++ b/src/include/stdlib.h @@ -9,6 +9,7 @@ #define __ALIGN_MASK(x,mask) (((x)+(mask))&~(mask)) #define ALIGN_UP(x,a) ALIGN((x),(a)) #define ALIGN_DOWN(x,a) ((x) & ~((typeof(x))(a)-1UL)) +#define IS_ALIGNED(x,a) (((x) & ((typeof(x))(a)-1UL)) == 0) #define MIN(a,b) ((a) < (b) ? (a) : (b)) #define MAX(a,b) ((a) > (b) ? (a) : (b)) |