diff options
author | Julius Werner <jwerner@chromium.org> | 2015-05-22 18:18:46 -0700 |
---|---|---|
committer | Patrick Georgi <pgeorgi@google.com> | 2015-06-02 12:03:45 +0200 |
commit | 68bdd00799c7b2b25f265fa9e31beb709c877eb6 (patch) | |
tree | 9d0ddaf95f10ebe515c946f2b6486ea928b11c11 /payloads | |
parent | 0bd22ce82c6e4beaacfe591a6ae8ce2874d042b7 (diff) |
libpayload: Add div_round_up() function
The lack of a div_round_up() function in libpayload keeps being a
problem for payloads and has already caused us to sprinkle numerous
less-readable ALIGN_UP(n, d) / d throughout depthcharge. Let's add this
so we can avoid adding any more and then maybe cocchinelle them all over
later.
BRANCH=None
BUG=None
TEST=None
Change-Id: I241a52770a0edcf7003b48a81875b3fa0cb7ed53
Signed-off-by: Patrick Georgi <pgeorgi@chromium.org>
Original-Commit-Id: a3f9514f9cfd325cc3c4b542020574b605fac935
Original-Change-Id: Ia55bd4bc52ab8a249b4854e40727cf6917af7b30
Original-Signed-off-by: Julius Werner <jwerner@chromium.org>
Original-Reviewed-on: https://chromium-review.googlesource.com/273050
Original-Reviewed-by: Patrick Georgi <pgeorgi@chromium.org>
Reviewed-on: http://review.coreboot.org/10392
Tested-by: build bot (Jenkins)
Reviewed-by: Stefan Reinauer <stefan.reinauer@coreboot.org>
Diffstat (limited to 'payloads')
-rw-r--r-- | payloads/libpayload/include/libpayload.h | 2 |
1 files changed, 2 insertions, 0 deletions
diff --git a/payloads/libpayload/include/libpayload.h b/payloads/libpayload/include/libpayload.h index 0be0d8e230..781a41d354 100644 --- a/payloads/libpayload/include/libpayload.h +++ b/payloads/libpayload/include/libpayload.h @@ -66,6 +66,8 @@ #define MAX(a,b) ((a) > (b) ? (a) : (b)) #define ARRAY_SIZE(a) (sizeof(a) / sizeof((a)[0])) +static inline u32 div_round_up(u32 n, u32 d) { return n + d - 1 / d; } + #define LITTLE_ENDIAN 1234 #define BIG_ENDIAN 4321 |