mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Add MSVC path for vkd3d_log2i.
Signed-off-by: Hans-Kristian Arntzen <post@arntzen-software.no> Signed-off-by: Henri Verbeet <hverbeet@codeweavers.com> Signed-off-by: Alexandre Julliard <julliard@winehq.org>
This commit is contained in:
parent
1e5ebae339
commit
69660ca5c9
@ -84,7 +84,13 @@ static inline bool vkd3d_bitmask_is_contiguous(unsigned int mask)
|
|||||||
/* Undefined for x == 0. */
|
/* Undefined for x == 0. */
|
||||||
static inline unsigned int vkd3d_log2i(unsigned int x)
|
static inline unsigned int vkd3d_log2i(unsigned int x)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BUILTIN_CLZ
|
#ifdef _MSC_VER
|
||||||
|
/* _BitScanReverse returns the index of the highest set bit,
|
||||||
|
* unlike clz which is 31 - index. */
|
||||||
|
unsigned long result;
|
||||||
|
_BitScanReverse(&result, x);
|
||||||
|
return (unsigned int)result;
|
||||||
|
#elif defined(HAVE_BUILTIN_CLZ)
|
||||||
return __builtin_clz(x) ^ 0x1f;
|
return __builtin_clz(x) ^ 0x1f;
|
||||||
#else
|
#else
|
||||||
static const unsigned int l[] =
|
static const unsigned int l[] =
|
||||||
|
Loading…
Reference in New Issue
Block a user