9
0
Fork 0

add roundup and rounddown support

Signed-off-by: Jean-Christophe PLAGNIOL-VILLARD <plagnioj@jcrosoft.com>
Signed-off-by: Sascha Hauer <s.hauer@pengutronix.de>
This commit is contained in:
Jean-Christophe PLAGNIOL-VILLARD 2012-11-03 21:58:29 +01:00 committed by Sascha Hauer
parent 85ca16d028
commit b27a52c9d6
1 changed files with 15 additions and 0 deletions

View File

@ -90,5 +90,20 @@
__val = __val < __min ? __min: __val; \
__val > __max ? __max: __val; })
/* The `const' in roundup() prevents gcc-3.3 from calling __divdi3 */
#define roundup(x, y) ( \
{ \
const typeof(y) __y = y; \
(((x) + (__y - 1)) / __y) * __y; \
} \
)
#define rounddown(x, y) ( \
{ \
typeof(x) __x = (x); \
__x - (__x % (y)); \
} \
)
#endif /* _LINUX_KERNEL_H */