Skip to content

Commit 3d0c4a6

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 8556b08 commit 3d0c4a6

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
@@ -523,7 +523,11 @@ static unsigned int __builtin_popcountl(unsigned int x) {
523523
}
524524
#else
525525
#include <intrin.h>
526+
#ifdef _WIN64
526527
#define __builtin_popcountl __popcnt64
528+
#else
529+
static unsigned int __builtin_popcountl(u64 n) { return __popcnt((u32)n) + __popcnt((u32)(n >> 32)); }
530+
#endif
527531
#endif
528532
#endif
529533

0 commit comments

Comments
 (0)