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:22:54 +0300
committerSergey Sharybin <sergey.vfx@gmail.com>2017-12-15 18:54:28 +0300
commit412de222f8711893f7ed66630b6b8a1473810ab2 (patch)
treebc16800b475eb5d2891c9f387f2b9e287c4a869c /source/blender/blenlib/BLI_math_bits.h
parent02ec0b53df0a966048500e659389dbb987847c49 (diff)
Math utils: Add bit scan operations
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 40a1d84b0e1..248b615e3f8 100644
--- a/source/blender/blenlib/BLI_math_bits.h
+++ b/source/blender/blenlib/BLI_math_bits.h
@@ -31,6 +31,14 @@ extern "C" {
#include "BLI_math_inline.h"
+/* Search the value from LSB to MSB for a set bit. Returns index of this bit. */
+MINLINE int bitscan_forward_i(int a);
+MINLINE unsigned int bitscan_forward_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);
+
/* 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);