From 46826c36bf1af1dcb4535f0838933f01f600a9d7 Mon Sep 17 00:00:00 2001 From: Aaron Durbin Date: Thu, 2 Apr 2015 15:43:12 -0500 Subject: [PATCH] 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 Original-Reviewed-on: https://chromium-review.googlesource.com/221800 Original-Reviewed-by: David Hendricks (cherry picked from commit 41bb8026818b4381d4a6d43d2d433c207c3971bc) Signed-off-by: Aaron Durbin Change-Id: I1e708b0aa53533c9ab999793ca2273c6dc68b5f6 Reviewed-on: http://review.coreboot.org/9253 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- src/include/stddef.h | 4 ++++ 1 file changed, 4 insertions(+) diff --git a/src/include/stddef.h b/src/include/stddef.h index 60e34595ee..3bbf914246 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( \