[Bf-blender-cvs] [f721308bd08] master: Fix bitscan_reverse_uint on MSVC compiler

Sergey Sharybin noreply at git.blender.org
Tue Jun 16 16:24:10 CEST 2020


Commit: f721308bd0893326c784dc2c2b084521ca3c38b8
Author: Sergey Sharybin
Date:   Tue Jun 16 16:16:56 2020 +0200
Branches: master
https://developer.blender.org/rBf721308bd0893326c784dc2c2b084521ca3c38b8

Fix bitscan_reverse_uint on MSVC compiler

Was a mistake from the very beginning of implementation.

===================================================================

M	source/blender/blenlib/intern/math_bits_inline.c

===================================================================

diff --git a/source/blender/blenlib/intern/math_bits_inline.c b/source/blender/blenlib/intern/math_bits_inline.c
index 8f8f257f1e7..e7a7b17e1e4 100644
--- a/source/blender/blenlib/intern/math_bits_inline.c
+++ b/source/blender/blenlib/intern/math_bits_inline.c
@@ -63,7 +63,7 @@ MINLINE unsigned int bitscan_reverse_uint(unsigned int a)
 #ifdef _MSC_VER
   unsigned long clz;
   _BitScanReverse(&clz, a);
-  return clz;
+  return 31 - clz;
 #else
   return (unsigned int)__builtin_clz(a);
 #endif



More information about the Bf-blender-cvs mailing list