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:
parent
85ca16d028
commit
b27a52c9d6
|
@ -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 */
|
||||
|
||||
|
|
Loading…
Reference in New Issue