Aaron Durbin (adurbin@google.com) just uploaded a new patch set to gerrit, which you can find at http://review.coreboot.org/9253
-gerrit
commit 778cb859470f4edf5376f79f110f8b06ea19230c Author: Aaron Durbin adurbin@chromium.org Date: Thu Apr 2 15:43:12 2015 -0500
stddef: Add KHz, MHz and GHz constants
This patch adds some simple constants to more easily write and do math with frequencies, analogous to the existing KiB, MiB and GiB constants for sizes.
BUG=None TEST=Compiled Veyron_Pinky.
Original-Change-Id: I4a1927fd423eb96d3f76f7e44b451192038b02e0 Original-Signed-off-by: Julius Werner jwerner@chromium.org Original-Reviewed-on: https://chromium-review.googlesource.com/221800 Original-Reviewed-by: David Hendricks dhendrix@chromium.org
(cherry picked from commit 41bb8026818b4381d4a6d43d2d433c207c3971bc) Signed-off-by: Aaron Durbin adurbin@chromium.org
Change-Id: I1e708b0aa53533c9ab999793ca2273c6dc68b5f6 --- src/include/stddef.h | 4 ++++ 1 file changed, 4 insertions(+)
diff --git a/src/include/stddef.h b/src/include/stddef.h index 60e3459..3bbf914 100644 --- a/src/include/stddef.h +++ b/src/include/stddef.h @@ -26,6 +26,10 @@ typedef unsigned int wint_t; /* Could we ever run into this one? I hope we get this much memory! */ #define TiB (1<<40)
+#define KHz (1000) +#define MHz (1000 * KHz) +#define GHz (1000 * MHz) + #define offsetof(TYPE, MEMBER) ((size_t) &((TYPE *)0)->MEMBER)
#define check_member(structure, member, offset) _Static_assert( \