Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/ValveSoftware/vkd3d.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorHans-Kristian Arntzen <post@arntzen-software.no>2019-10-01 13:33:38 +0300
committerAlexandre Julliard <julliard@winehq.org>2019-10-01 20:14:20 +0300
commit1e5ebae3392a0b72c069280570a5cac7f00fd0a9 (patch)
tree002d70c3ffe3e89926bd2256d52228ca26a7e4d7
parentc3b78286d781a93ddde2ec5a5a71a81363974664 (diff)
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>
-rw-r--r--include/private/vkd3d_common.h8
1 files changed, 7 insertions, 1 deletions
diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h
index 1ac8a63b..ba4b68a5 100644
--- a/include/private/vkd3d_common.h
+++ b/include/private/vkd3d_common.h
@@ -26,6 +26,10 @@
#include <limits.h>
#include <stdbool.h>
+#ifdef _MSC_VER
+#include <intrin.h>
+#endif
+
#ifndef ARRAY_SIZE
# define ARRAY_SIZE(x) (sizeof(x) / sizeof(*(x)))
#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)
{
-#ifdef HAVE_BUILTIN_POPCOUNT
+#ifdef _MSC_VER
+ return __popcnt(v);
+#elif defined(HAVE_BUILTIN_POPCOUNT)
return __builtin_popcount(v);
#else
v -= (v >> 1) & 0x55555555;