]> git.kernelconcepts.de Git - karo-tx-uboot.git/commitdiff
Add ALIGN() macro
authorAndy Fleming <afleming@freescale.com>
Mon, 16 Jun 2008 18:58:53 +0000 (13:58 -0500)
committerWolfgang Denk <wd@denx.de>
Sat, 28 Jun 2008 20:20:29 +0000 (22:20 +0200)
ALIGN() returns the smallest aligned value greater than the passed
in address or size.  Taken from Linux.

Signed-off-by: Andy Fleming <afleming@freescale.com>
include/common.h

index fd5adb3d6db444b43f86a3b73d9b6f69053ed1b6..319078178bfa9c64a054e2c394a1d7eba462f0cd 100644 (file)
@@ -682,6 +682,9 @@ void __attribute__((weak)) show_boot_progress (int val);
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 #define roundup(x, y) ((((x) + ((y) - 1)) / (y)) * (y))
 
+#define ALIGN(x,a)             __ALIGN_MASK((x),(typeof(x))(a)-1)
+#define __ALIGN_MASK(x,mask)   (((x)+(mask))&~(mask))
+
 /* Multicore arch functions */
 #ifdef CONFIG_MP
 int cpu_status(int nr);