Skip to content

Commit 87ded4f

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 330f021 commit 87ded4f

File tree

1 file changed

+4
-0
lines changed

1 file changed

+4
-0
lines changed

sqlite-vec.c

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -529,7 +529,11 @@ static unsigned int __builtin_popcountl(unsigned int x) {
529529
}
530530
#else
531531
#include <intrin.h>
532+
#ifdef _WIN64
532533
#define __builtin_popcountl __popcnt64
534+
#else
535+
static unsigned int __builtin_popcountl(u64 n) { return __popcnt((u32)n) + __popcnt((u32)(n >> 32)); }
536+
#endif
533537
#endif
534538
#endif
535539

0 commit comments

Comments
 (0)