Hans-Kristian Arntzen : vkd3d: Add MSVC path for popcount.

Alexandre Julliard julliard at winehq.org
Tue Oct 1 15:42:40 CDT 2019


Module: vkd3d
Branch: master
Commit: 1e5ebae3392a0b72c069280570a5cac7f00fd0a9
URL:    https://source.winehq.org/git/vkd3d.git/?a=commit;h=1e5ebae3392a0b72c069280570a5cac7f00fd0a9

Author: Hans-Kristian Arntzen <post at arntzen-software.no>
Date:   Tue Oct  1 12:33:38 2019 +0200

vkd3d: Add MSVC path for popcount.

Signed-off-by: Hans-Kristian Arntzen <post at arntzen-software.no>
Signed-off-by: Henri Verbeet <hverbeet at codeweavers.com>
Signed-off-by: Alexandre Julliard <julliard at winehq.org>

---

 include/private/vkd3d_common.h | 8 +++++++-
 1 file changed, 7 insertions(+), 1 deletion(-)

diff --git a/include/private/vkd3d_common.h b/include/private/vkd3d_common.h
index 1ac8a63..ba4b68a 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;




More information about the wine-cvs mailing list