From 68bdd00799c7b2b25f265fa9e31beb709c877eb6 Mon Sep 17 00:00:00 2001 From: Julius Werner Date: Fri, 22 May 2015 18:18:46 -0700 Subject: 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 Original-Commit-Id: a3f9514f9cfd325cc3c4b542020574b605fac935 Original-Change-Id: Ia55bd4bc52ab8a249b4854e40727cf6917af7b30 Original-Signed-off-by: Julius Werner Original-Reviewed-on: https://chromium-review.googlesource.com/273050 Original-Reviewed-by: Patrick Georgi Reviewed-on: http://review.coreboot.org/10392 Tested-by: build bot (Jenkins) Reviewed-by: Stefan Reinauer --- payloads/libpayload/include/libpayload.h | 2 ++ 1 file changed, 2 insertions(+) (limited to 'payloads') 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 -- cgit v1.2.3