Skip to content

Commit 0fc73cc

Browse files
committed
Fix Windows x86 u64 popcount
1 parent 12764ce commit 0fc73cc

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

include/xsimd/types/xsimd_bit.hpp

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -81,7 +81,11 @@ namespace xsimd
8181
#elif XSIMD_HAS_BUILTIN(__builtin_popcount)
8282
return __builtin_popcount((unsigned int)x) + __builtin_popcount((unsigned int)(x >> 32));
8383
#elif defined(_MSC_VER)
84+
#ifdef _M_X64
8485
return (int)__popcnt64(x);
86+
#else
87+
return (int)(__popcnt((unsigned int)x) + __popcnt((unsigned int)(x >> 32)));
88+
#endif
8589
#else
8690
// https://graphics.stanford.edu/~seander/bithacks.html#CountBitsSetParallel
8791
x = x - ((x >> 1) & (T) ~(T)0 / 3);

0 commit comments

Comments
 (0)