common: add ALIGN_DOWN macro
Signed-off-by: Alexander Aring <alex.aring@gmail.com> Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
parent
71218359af
commit
49686838a9
|
@ -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)
|
||||
|
||||
|
|
Loading…
Reference in New Issue