summaryrefslogtreecommitdiffstats
path: root/src/include/stddef.h
diff options
context:
space:
mode:
authorRonald G. Minnich <rminnich@gmail.com>2013-03-15 20:17:26 -0700
committerRonald G. Minnich <rminnich@gmail.com>2013-03-16 16:15:01 +0100
commitaa3f4287d40f7f3c7b1fca1af5cfa426ff4fa27f (patch)
tree8e4cf6571c516463f5a08db6f1744e719c80486d /src/include/stddef.h
parent5c66f08a3a901eb3e1fe6cfd7f22b90cecbf3cf7 (diff)
downloadcoreboot-aa3f4287d40f7f3c7b1fca1af5cfa426ff4fa27f.tar.gz
coreboot-aa3f4287d40f7f3c7b1fca1af5cfa426ff4fa27f.tar.bz2
coreboot-aa3f4287d40f7f3c7b1fca1af5cfa426ff4fa27f.zip
stddef.h: Add standard defines for KiB, MiB, GiB, and TiB
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@gmail.com> Reviewed-on: http://review.coreboot.org/2769 Reviewed-by: Paul Menzel <paulepanter@users.sourceforge.net> Tested-by: build bot (Jenkins)
Diffstat (limited to 'src/include/stddef.h')
-rw-r--r--src/include/stddef.h7
1 files changed, 7 insertions, 0 deletions
diff --git a/src/include/stddef.h b/src/include/stddef.h
index 888d4978097c..5b51c00635c5 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__