diff options
author | Clément Foucault <foucault.clem@gmail.com> | 2022-05-18 22:31:10 +0300 |
---|---|---|
committer | Clément Foucault <foucault.clem@gmail.com> | 2022-05-19 00:01:08 +0300 |
commit | 790598fa609accde463bbda9c990dd55f881940c (patch) | |
tree | d4c1e9fe96c4e15304373936ba8e0f18e0368266 /source/blender/blenlib | |
parent | fe4ae77deda916b37ee5b48b2c5b4e3e220f664e (diff) |
Cleanup: BLI_math_base.h: Document `power_of_2_max|min()`
Diffstat (limited to 'source/blender/blenlib')
-rw-r--r-- | source/blender/blenlib/BLI_math_base.h | 10 |
1 files changed, 7 insertions, 3 deletions
diff --git a/source/blender/blenlib/BLI_math_base.h b/source/blender/blenlib/BLI_math_base.h index f9c05fb116e..f072a17f384 100644 --- a/source/blender/blenlib/BLI_math_base.h +++ b/source/blender/blenlib/BLI_math_base.h @@ -204,13 +204,17 @@ MINLINE int integer_digits_i(int i); /* These don't really fit anywhere but were being copied about a lot. */ MINLINE int is_power_of_2_i(int n); + +MINLINE unsigned int log2_floor_u(unsigned int x); +MINLINE unsigned int log2_ceil_u(unsigned int x); + +/** + * Returns next (or previous) power of 2 or the input number if it is already a power of 2. + */ MINLINE int power_of_2_max_i(int n); MINLINE int power_of_2_min_i(int n); - MINLINE unsigned int power_of_2_max_u(unsigned int x); MINLINE unsigned int power_of_2_min_u(unsigned int x); -MINLINE unsigned int log2_floor_u(unsigned int x); -MINLINE unsigned int log2_ceil_u(unsigned int x); /** * Integer division that rounds 0.5 up, particularly useful for color blending |