summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorAlexander Aring <alex.aring@gmail.com>2013-06-04 01:13:49 +0200
committerSascha Hauer <s.hauer@pengutronix.de>2013-06-05 22:54:34 +0200
commit49686838a906e311967ccb79fd27f3ad30c7f157 (patch)
treeda86bf3d8d4fe38c6833e8dab4cff07cd4d61e93
parent71218359afe8fa05153e53a64973a76cb90997b5 (diff)
downloadbarebox-49686838a906e311967ccb79fd27f3ad30c7f157.tar.gz
barebox-49686838a906e311967ccb79fd27f3ad30c7f157.tar.xz
common: add ALIGN_DOWN macro
Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
-rw-r--r--include/common.h1
1 files changed, 1 insertions, 0 deletions
diff --git a/include/common.h b/include/common.h
index 293ca49391..fc2c8ca8be 100644
--- a/include/common.h
+++ b/include/common.h
@@ -184,6 +184,7 @@ int run_shell(void);
#define ALIGN(x, a) __ALIGN_MASK(x, (typeof(x))(a) - 1)
#define __ALIGN_MASK(x, mask) (((x) + (mask)) & ~(mask))
+#define ALIGN_DOWN(x, a) ((x) & ~((typeof(x))(a) - 1))
#define PTR_ALIGN(p, a) ((typeof(p))ALIGN((unsigned long)(p), (a)))
#define IS_ALIGNED(x, a) (((x) & ((typeof(x))(a) - 1)) == 0)