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:
Diffstat (limited to 'source/blender/blenlib/intern/math_bits_inline.c')
-rw-r--r--source/blender/blenlib/intern/math_bits_inline.c11
1 files changed, 5 insertions, 6 deletions
diff --git a/source/blender/blenlib/intern/math_bits_inline.c b/source/blender/blenlib/intern/math_bits_inline.c
index a6883c2aaba..8f8f257f1e7 100644
--- a/source/blender/blenlib/intern/math_bits_inline.c
+++ b/source/blender/blenlib/intern/math_bits_inline.c
@@ -77,8 +77,7 @@ MINLINE int bitscan_reverse_i(int a)
MINLINE unsigned int bitscan_reverse_clear_uint(unsigned int *a)
{
unsigned int i = bitscan_reverse_uint(*a);
- /* TODO(sergey): This could probably be optimized. */
- *a &= ~(1 << (sizeof(unsigned int) * 8 - i - 1));
+ *a &= ~(0x80000000 >> i);
return i;
}
@@ -97,10 +96,10 @@ MINLINE unsigned int highest_order_bit_uint(unsigned int n)
MINLINE unsigned short highest_order_bit_s(unsigned short n)
{
- n |= (n >> 1);
- n |= (n >> 2);
- n |= (n >> 4);
- n |= (n >> 8);
+ n |= (unsigned short)(n >> 1);
+ n |= (unsigned short)(n >> 2);
+ n |= (unsigned short)(n >> 4);
+ n |= (unsigned short)(n >> 8);
return (unsigned short)(n - (n >> 1));
}