Skip to content

Commit 4a720aa

Browse files
Avoid __popcnt64 on MSVC Windows 32-bit platform
The `__popcnt64` intrinsic isn't supported on 32-bit Windows, so `__popcnt` should be used instead.
1 parent a2dd24f commit 4a720aa

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sqlite-vec.c

+4
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,11 @@ static unsigned int __builtin_popcountl(unsigned int x) {
533533
}
534534
#else
535535
#include <intrin.h>
536+
#ifdef _WIN64
536537
#define __builtin_popcountl __popcnt64
538+
#else
539+
static unsigned int __builtin_popcountl(u64 n) { return __popcnt((u32)n) + __popcnt((u32)(n >> 32)); }
540+
#endif
537541
#endif
538542
#endif
539543

0 commit comments

Comments
 (0)