Welcome to mirror list, hosted at ThFree Co, Russian Federation.

git.blender.org/blender.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorSergey Sharybin <sergey.vfx@gmail.com>2017-12-15 18:41:31 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-15 18:54:28 +0300
commit5e28b71457e8c8ce20e19a28ce44c9d9b5f47844 (patch)
tree712007ae2ce57a282bf265eb434838f495c6a9cc /source/blender/blenlib/BLI_math_bits.h
parentde9e5a092659cf2424b55dca4ac6f149966fe427 (diff)
math utils: Add utilities to scan bit and clear it
Diffstat (limited to 'source/blender/blenlib/BLI_math_bits.h')
-rw-r--r--source/blender/blenlib/BLI_math_bits.h8
1 files changed, 8 insertions, 0 deletions
diff --git a/source/blender/blenlib/BLI_math_bits.h b/source/blender/blenlib/BLI_math_bits.h
index 248b615e3f8..86213dc271f 100644
--- a/source/blender/blenlib/BLI_math_bits.h
+++ b/source/blender/blenlib/BLI_math_bits.h
@@ -35,10 +35,18 @@ extern "C" {
MINLINE int bitscan_forward_i(int a);
MINLINE unsigned int bitscan_forward_uint(unsigned int a);
+/* Similar to above, but also clears the bit. */
+MINLINE int bitscan_forward_clear_i(int *a);
+MINLINE unsigned int bitscan_forward_clear_uint(unsigned int *a);
+
/* Search the value from MSB to LSB for a set bit. Returns index of this bit. */
MINLINE int bitscan_reverse_i(int a);
MINLINE unsigned int bitscan_reverse_uint(unsigned int a);
+/* Similar to above, but also clears the bit. */
+MINLINE int bitscan_reverse_clear_i(int *a);
+MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a);
+
/* NOTE: Those functions returns 2 to the power of index of highest order bit. */
MINLINE unsigned int highest_order_bit_uint(unsigned int n);
MINLINE unsigned short highest_order_bit_s(unsigned short n);