diff options
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 1 | ||||
-rw-r--r-- | source/blender/blenlib/intern/math_base_inline.c | 8 |
2 files changed, 9 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index ae9617d2f16..e76c41970c6 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -33,6 +33,7 @@ #include "BLI_assert.h" #include "BLI_math_inline.h" +#include "BLI_sys_types.h" #include <math.h> #ifndef M_PI diff --git a/source/blender/blenlib/intern/math_base_inline.c b/source/blender/blenlib/intern/math_base_inline.c index e0cac508d28..6db3ea819a4 100644 --- a/source/blender/blenlib/intern/math_base_inline.c +++ b/source/blender/blenlib/intern/math_base_inline.c @@ -356,6 +356,14 @@ MINLINE int divide_floor_i(int a, int b) } /** + * Integer division that ceils the result, instead of flooring like normal C division. + */ +MINLINE uint divide_ceil_u(uint a, uint b) +{ + return (a + b - 1) / b; +} + +/** * modulo that handles negative numbers, works the same as Python's. */ MINLINE int mod_i(int i, int n) |