Replace MSVC implementation of __builtin_popcount with C code

This commit is contained in:
Marius Greuel 2022-01-05 16:52:41 +01:00
parent e1221e22ff
commit 80d53839dd
1 changed files with 13 additions and 2 deletions

View File

@ -32,10 +32,21 @@
#define PATH_MAX _MAX_PATH #define PATH_MAX _MAX_PATH
#define __builtin_popcount __popcnt
#define setvbuf msvc_setvbuf #define setvbuf msvc_setvbuf
static inline int __builtin_popcount(unsigned int v)
{
int count = 0;
while (v)
{
count += v & 1;
v >>= 1;
}
return count;
}
static inline int msvc_setvbuf( static inline int msvc_setvbuf(
FILE* const public_stream, FILE* const public_stream,
char* const buffer, char* const buffer,