macros: add ROUNDUP macro

* macros.h (ROUNDUP): New macro.
This commit is contained in:
Eugene Syromyatnikov 2018-09-02 18:15:40 +02:00
parent 11c4fc6d99
commit 53faa8304c

View File

@ -48,6 +48,10 @@
#endif
#define CLAMP(val, min, max) MIN(MAX(min, val), max)
#ifndef ROUNDUP
# define ROUNDUP(val_, div_) ((((val_) + (div_) - 1) / (div_)) * (div_))
#endif
#ifndef offsetofend
# define offsetofend(type_, member_) \
(offsetof(type_, member_) + sizeof(((type_ *)0)->member_))