summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-07-30 02:32:38 +0300
committerGitHub <noreply@github.com>2020-07-29 16:32:38 -0700
commit4253dae801b7f5526c28c4bbd8cda1d32067344d (patch)
tree2c5530d3899698d2cea8cfd9c832cdb657d77dc7
parent95a33d7e3233c0f00b0043bb2225d514ae1cd10e (diff)
downloadbinaryen-4253dae801b7f5526c28c4bbd8cda1d32067344d.tar.gz
binaryen-4253dae801b7f5526c28c4bbd8cda1d32067344d.tar.bz2
binaryen-4253dae801b7f5526c28c4bbd8cda1d32067344d.zip
Fix build for win32 (#3001)
Check for x64 before using a non-32bit operation. See #2955 for context.
-rw-r--r--src/support/bits.cpp4
1 files changed, 2 insertions, 2 deletions
diff --git a/src/support/bits.cpp b/src/support/bits.cpp
index 8dc0f31df..63b744eb4 100644
--- a/src/support/bits.cpp
+++ b/src/support/bits.cpp
@@ -97,7 +97,7 @@ template<> int CountTrailingZeroes<uint64_t>(uint64_t v) {
}
#if __has_builtin(__builtin_ctzll) || defined(__GNUC__)
return __builtin_ctzll(v);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && defined(_M_X64)
unsigned long count;
_BitScanForward64(&count, v);
return (int)count;
@@ -139,7 +139,7 @@ template<> int CountLeadingZeroes<uint64_t>(uint64_t v) {
}
#if __has_builtin(__builtin_clzll) || defined(__GNUC__)
return __builtin_clzll(v);
-#elif defined(_MSC_VER)
+#elif defined(_MSC_VER) && defined(_M_X64)
unsigned long count;
_BitScanReverse64(&count, v);
return (int)count;