diff --git a/src/msvc/msvc_compat.h b/src/msvc/msvc_compat.h index 19acf5b8..03bb178e 100644 --- a/src/msvc/msvc_compat.h +++ b/src/msvc/msvc_compat.h @@ -36,10 +36,21 @@ #define PATH_MAX _MAX_PATH -#define __builtin_popcount __popcnt - #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( FILE* const public_stream, char* const buffer,