diff options
-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 |