[WINESYNC] d3dx9: Use BitScanReverse in make_pow2.
authorwinesync <ros-dev@reactos.org>
Mon, 21 Sep 2020 21:07:38 +0000 (23:07 +0200)
committerJérôme Gardou <jerome.gardou@reactos.org>
Thu, 4 Feb 2021 15:37:06 +0000 (16:37 +0100)
Signed-off-by: Jacek Caban <jacek@codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni@codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard@winehq.org>
wine commit id 22970932d014f024fcf7f0f98b1a5384b1b1eb99 by Jacek Caban <jacek@codeweavers.com>

dll/directx/wine/d3dx9_36/d3dx9_private.h
sdk/tools/winesync/d3dx9.cfg

index 92116b1..66c93d2 100644 (file)
@@ -229,19 +229,12 @@ static inline BOOL is_param_type_sampler(D3DXPARAMETER_TYPE type)
 /* Returns the smallest power of 2 which is greater than or equal to num */
 static inline uint32_t make_pow2(uint32_t num)
 {
-#if defined(__GNUC__) && ((__GNUC__ > 3) || ((__GNUC__ == 3) && (__GNUC_MINOR__ >= 3)))
-    return num == 1 ? 1 : 1u << ((__builtin_clz(num - 1) ^ 0x1f) + 1);
+#ifndef __REACTOS__
+    uint32_t index;
 #else
-    num--;
-    num |= num >> 1;
-    num |= num >> 2;
-    num |= num >> 4;
-    num |= num >> 8;
-    num |= num >> 16;
-    num++;
-
-    return num;
+    unsigned long index;
 #endif
+    return BitScanReverse(&index, num - 1) ? 1u << (index + 1) : 1;
 }
 
 struct d3dx_parameter;
index 385ddb2..868488f 100644 (file)
@@ -15,4 +15,4 @@ files: {include/d3dx9.h: sdk/include/dxsdk/d3dx9.h, include/d3dx9anim.h: sdk/inc
   include/d3dx9mesh.h: sdk/include/dxsdk/d3dx9mesh.h, include/d3dx9of.h: sdk/include/dxsdk/d3dx9of.h,
   include/d3dx9shader.h: sdk/include/dxsdk/d3dx9shader.h, include/d3dx9shape.h: sdk/include/dxsdk/d3dx9shape.h,
   include/d3dx9tex.h: sdk/include/dxsdk/d3dx9tex.h, include/d3dx9xof.h: sdk/include/dxsdk/d3dx9xof.h}
-tags: {wine: c1cf13a7512387885616684130b605a7640f5187}
+tags: {wine: 22970932d014f024fcf7f0f98b1a5384b1b1eb99}