[coreboot] New patch to review for coreboot: 918a5c6 Add standard defines

Ronald G. Minnich (rminnich@gmail.com) gerrit at coreboot.org
Sat Mar 16 04:18:23 CET 2013


Ronald G. Minnich (rminnich at gmail.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/2769

-gerrit

commit 918a5c64f503945a878831cd46a835926d97179b
Author: Ronald G. Minnich <rminnich at gmail.com>
Date:   Fri Mar 15 20:17:26 2013 -0700

    Add standard defines
    
    Paul points out that some people like 1024*1024, others like
    1048576, but in any case these are all open to typos.
    
    Define KiB, MiB, GiB, and TiB as in the standard so people can use them.
    
    Change-Id: Ic1b57e70d3e9b9e1c0242299741f71db91e7cd3f
    Signed-off-by: Ronald G. Minnich <rminnich at gmail.com>
---
 src/include/stddef.h | 7 +++++++
 1 file changed, 7 insertions(+)

diff --git a/src/include/stddef.h b/src/include/stddef.h
index 888d497..c96c765 100644
--- a/src/include/stddef.h
+++ b/src/include/stddef.h
@@ -13,6 +13,13 @@ typedef unsigned int wint_t;
 
 #define NULL ((void *)0)
 
+/* standard units. */
+#define KiB (1<<10)
+#define MiB (1<<20)
+#define GiB (1<<30)
+/* could we ever run into this one? I hope we get this much memory! */
+#define TiB (1<<40)
+
 #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
 
 #ifdef __PRE_RAM__



More information about the coreboot mailing list