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. They are exemplary added to the Veyron_Pinky/Rk3288 code for
now and will hopefully be adopted by other parts of the codebase in the
future.

BUG=None
TEST=Compiled Veyron_Pinky.

Change-Id: I4a1927fd423eb96d3f76f7e44b451192038b02e0
Signed-off-by: Julius Werner <jwerner@chromium.org>
Reviewed-on: https://chromium-review.googlesource.com/221800
Reviewed-by: David Hendricks <dhendrix@chromium.org>
This commit is contained in:
Julius Werner 2014-10-06 13:41:28 -07:00 committed by chrome-internal-fetch
commit 41bb802681
11 changed files with 45 additions and 42 deletions

View file

@ -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( \