mirror of
https://gitlab.winehq.org/wine/vkd3d.git
synced 2024-11-21 16:46:41 -08:00
vkd3d: Add MSVC path for popcount.
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
c3b78286d7
commit
1e5ebae339
@ -26,6 +26,10 @@
|
|||||||
#include <limits.h>
|
#include <limits.h>
|
||||||
#include <stdbool.h>
|
#include <stdbool.h>
|
||||||
|
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
#include <intrin.h>
|
||||||
|
#endif
|
||||||
|
|
||||||
#ifndef ARRAY_SIZE
|
#ifndef ARRAY_SIZE
|
||||||
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
|
||||||
#endif
|
#endif
|
||||||
@ -51,7 +55,9 @@ static inline size_t align(size_t addr, size_t alignment)
|
|||||||
|
|
||||||
static inline unsigned int vkd3d_popcount(unsigned int v)
|
static inline unsigned int vkd3d_popcount(unsigned int v)
|
||||||
{
|
{
|
||||||
#ifdef HAVE_BUILTIN_POPCOUNT
|
#ifdef _MSC_VER
|
||||||
|
return __popcnt(v);
|
||||||
|
#elif defined(HAVE_BUILTIN_POPCOUNT)
|
||||||
return __builtin_popcount(v);
|
return __builtin_popcount(v);
|
||||||
#else
|
#else
|
||||||
v -= (v >> 1) & 0x55555555;
|
v -= (v >> 1) & 0x55555555;
|
||||||
|
Loading…
x
Reference in New Issue
Block a user