Jacek Caban : d3dx9: Use BitScanReverse in make_pow2.
Alexandre Julliard
julliard at winehq.org
Thu Jun 11 15:26:47 CDT 2020
Module: wine
Branch: master
Commit: 22970932d014f024fcf7f0f98b1a5384b1b1eb99
URL: https://source.winehq.org/git/wine.git/?a=commit;h=22970932d014f024fcf7f0f98b1a5384b1b1eb99
Author: Jacek Caban <jacek at codeweavers.com>
Date: Wed Jun 10 14:21:03 2020 +0200
d3dx9: Use BitScanReverse in make_pow2.
Signed-off-by: Jacek Caban <jacek at codeweavers.com>
Signed-off-by: Matteo Bruni <mbruni at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>
---
dlls/d3dx9_36/d3dx9_private.h | 15 ++-------------
1 file changed, 2 insertions(+), 13 deletions(-)
diff --git a/dlls/d3dx9_36/d3dx9_private.h b/dlls/d3dx9_36/d3dx9_private.h
index d64b9af30c..c3308b04d4 100644
--- a/dlls/d3dx9_36/d3dx9_private.h
+++ b/dlls/d3dx9_36/d3dx9_private.h
@@ -229,19 +229,8 @@ 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);
-#else
- num--;
- num |= num >> 1;
- num |= num >> 2;
- num |= num >> 4;
- num |= num >> 8;
- num |= num >> 16;
- num++;
-
- return num;
-#endif
+ uint32_t index;
+ return BitScanReverse(&index, num - 1) ? 1u << (index + 1) : 1;
}
struct d3dx_parameter;
More information about the wine-cvs
mailing list