private: add macros ROUND_UP and DIV_ROUND_UP

This commit is contained in:
Boris Faure 2016-12-18 18:46:41 +01:00
parent 82d9ead6f2
commit 836baf5d63
1 changed files with 10 additions and 0 deletions

View File

@ -28,4 +28,14 @@ extern int _log_domain;
# define MAX(x, y) (((x) > (y)) ? (x) : (y))
#endif
#ifndef DIV_ROUND_UP
# define DIV_ROUND_UP(_v, _n) \
(((_v) + (_n) - 1) / (_n))
#endif
#ifndef ROUND_UP
# define ROUND_UP(_v, _n) \
(DIV_ROUND_UP((_v), (_n)) * (_n))
#endif
#endif