Skip to content

Commit

Permalink
Avoid __popcnt64 on MSVC Windows 32-bit platform
Browse files Browse the repository at this point in the history
The `__popcnt64` intrinsic isn't supported on 32-bit Windows, so `__popcnt` should be used instead.
  • Loading branch information
frederick-vs-ja committed Oct 15, 2024
1 parent 9cc0dea commit ebb6e97
Showing 1 changed file with 4 additions and 0 deletions.
4 changes: 4 additions & 0 deletions sqlite-vec.c
Original file line number Diff line number Diff line change
Expand Up @@ -529,7 +529,11 @@ static unsigned int __builtin_popcountl(unsigned int x) {
}
#else
#include <intrin.h>
#ifdef _WIN64
#define __builtin_popcountl __popcnt64
#else
static unsigned int __builtin_popcountl(u64 n) { return __popcnt((u32)n) + __popcnt((u32)(n >> 32)); }
#endif
#endif
#endif

Expand Down

0 comments on commit ebb6e97

Please sign in to comment.