]> git.sur5r.net Git - u-boot/commitdiff
linux/kernel.h: import DIV_ROUND_{DOWN, UP}_ULL from Linux
authorMasahiro Yamada <yamada.masahiro@socionext.com>
Wed, 13 Sep 2017 10:16:44 +0000 (19:16 +0900)
committerTom Rini <trini@konsulko.com>
Fri, 6 Oct 2017 01:31:04 +0000 (21:31 -0400)
These macros are useful to avoid link error on 32-bit systems.

Signed-off-by: Masahiro Yamada <yamada.masahiro@socionext.com>
include/linux/kernel.h

index 0b616713cc3b77d8d9f8d3da7e6445f5bf72879d..87d2d9554dbb7947aeb9aa61cf9cb437765bdcdd 100644 (file)
 #define FIELD_SIZEOF(t, f) (sizeof(((t*)0)->f))
 #define DIV_ROUND_UP(n,d) (((n) + (d) - 1) / (d))
 
+#define DIV_ROUND_DOWN_ULL(ll, d) \
+       ({ unsigned long long _tmp = (ll); do_div(_tmp, d); _tmp; })
+
+#define DIV_ROUND_UP_ULL(ll, d)                DIV_ROUND_DOWN_ULL((ll) + (d) - 1, (d))
+
 #if BITS_PER_LONG == 32
 # define DIV_ROUND_UP_SECTOR_T(ll,d) DIV_ROUND_UP_ULL(ll, d)
 #else