diff options
author | Colin Basnett <cmbasnett@gmail.com> | 2022-09-17 03:50:37 +0300 |
---|---|---|
committer | Colin Basnett <cmbasnett@gmail.com> | 2022-09-17 03:50:37 +0300 |
commit | 564bda241a973396da51d7c3ccd9efd97d51728a (patch) | |
tree | 4d9aa4cccd82e2e606b47774afa5e1015bf14768 /source/blender/blenlib/BLI_math_base.h | |
parent | 0fff238150d076576053c25b646f653d6e3b0edb (diff) | |
parent | 48d7ff68f0df209c77bbb081ab46fbc109fd825a (diff) |
Merge branch 'master' into feature-imformatfeature-imformat
Diffstat (limited to 'source/blender/blenlib/BLI_math_base.h')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 13 |
1 files changed, 13 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index f072a17f384..c0c4594ddc0 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -221,6 +221,19 @@ MINLINE unsigned int power_of_2_min_u(unsigned int x); * with integers, to avoid gradual darkening when rounding down. */ MINLINE int divide_round_i(int a, int b); + +/** + * Integer division that returns the ceiling, instead of flooring like normal C division. + */ +MINLINE uint divide_ceil_u(uint a, uint b); +MINLINE uint64_t divide_ceil_ul(uint64_t a, uint64_t b); + +/** + * Returns \a a if it is a multiple of \a b or the next multiple or \a b after \b a . + */ +MINLINE uint ceil_to_multiple_u(uint a, uint b); +MINLINE uint64_t ceil_to_multiple_ul(uint64_t a, uint64_t b); + /** * modulo that handles negative numbers, works the same as Python's. */ |