summaryrefslogtreecommitdiff
path: root/src/ir
diff options
context:
space:
mode:
authorMax Graey <maxgraey@gmail.com>2020-07-07 01:38:00 +0300
committerGitHub <noreply@github.com>2020-07-06 15:38:00 -0700
commit18095a6c6030fb157f89889b8094eca0b3f654cb (patch)
tree4b6ce4580b3602de916ab438d94e5ec81fae6970 /src/ir
parent49421e42a8082a1b75dda65411af3fb4b0ba9fe5 (diff)
downloadbinaryen-18095a6c6030fb157f89889b8094eca0b3f654cb.tar.gz
binaryen-18095a6c6030fb157f89889b8094eca0b3f654cb.tar.bz2
binaryen-18095a6c6030fb157f89889b8094eca0b3f654cb.zip
Avoid __popcnt and __popcnt64 intrinsics for MSVC (#2944)
We may need to check the CPU ID or something else before using those special things on MSVC. To be safe, avoid them for now.
Diffstat (limited to 'src/ir')
-rw-r--r--src/ir/bits.h6
1 files changed, 3 insertions, 3 deletions
diff --git a/src/ir/bits.h b/src/ir/bits.h
index 6b0697280..8b28bb031 100644
--- a/src/ir/bits.h
+++ b/src/ir/bits.h
@@ -43,9 +43,9 @@ struct Bits {
if (mask == 0) {
return 0; // trivially not a mask
}
- // otherwise, see if adding one turns this into a 1-bit thing, 00011111 + 1
- // => 00100000
- if (PopCount(mask + 1) != 1) {
+ // otherwise, see if x & (x + 1) turns this into non-zero value
+ // 00011111 & (00011111 + 1) => 0
+ if (mask & (mask + 1)) {
return 0;
}
// this is indeed a mask