[coreboot-gerrit] New patch to review for coreboot: 2d73802 stdlib: add ALIGN_UP and ALIGN_DOWN macros

Aaron Durbin (adurbin@google.com) gerrit at coreboot.org
Fri Mar 29 04:49:58 CET 2013

Aaron Durbin (adurbin at google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2951


commit 2d73802270fe32bd5c769c0d93401d67392dd4bf
Author: Aaron Durbin <adurbin at chromium.org>
Date:   Thu Mar 28 16:17:11 2013 -0500

    stdlib: add ALIGN_UP and ALIGN_DOWN macros
    There wasn't an equivalent to align down so add ALIGN_DOWN.
    For symmetry provide an ALIGN_UP macro as well.
    Change-Id: I7033109311eeb15c8c69c649878785378790feb9
    Signed-off-by: Aaron Durbin <adurbin at chromium.org>
 src/include/stdlib.h | 2 ++
 1 file changed, 2 insertions(+)

diff --git a/src/include/stdlib.h b/src/include/stdlib.h
index 83eb966..cb5a6ca7 100644
--- a/src/include/stdlib.h
+++ b/src/include/stdlib.h
@@ -7,6 +7,8 @@
 #define ALIGN(x,a)              __ALIGN_MASK(x,(typeof(x))(a)-1UL)
 #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 MIN(a,b) ((a) < (b) ? (a) : (b))
 #define MAX(a,b) ((a) > (b) ? (a) : (b))

More information about the coreboot-gerrit mailing list