qemu/host-utils: Handle ctpop8/16/32/64 on MSVC

Maybe not the most platform friendly way of doing so
This commit is contained in:
Lioncash 2019-01-30 13:29:41 -05:00
parent 4e605ba038
commit 0de4a47169
No known key found for this signature in database
GPG key ID: 4E3C3CC1031BA9C7

View file

@ -292,7 +292,11 @@ static inline int clrsb64(uint64_t val)
*/
static inline int ctpop8(uint8_t val)
{
#ifdef _MSC_VER
return __popcnt(val);
#else
return __builtin_popcount(val);
#endif
}
/**
@ -301,7 +305,11 @@ static inline int ctpop8(uint8_t val)
*/
static inline int ctpop16(uint16_t val)
{
#ifdef _MSC_VER
return __popcnt(val);
#else
return __builtin_popcount(val);
#endif
}
/**
@ -310,7 +318,11 @@ static inline int ctpop16(uint16_t val)
*/
static inline int ctpop32(uint32_t val)
{
#ifdef _MSC_VER
return __popcnt(val);
#else
return __builtin_popcount(val);
#endif
}
/**
@ -319,7 +331,11 @@ static inline int ctpop32(uint32_t val)
*/
static inline int ctpop64(uint64_t val)
{
#ifdef _MSC_VER
return __popcnt64(val);
#else
return __builtin_popcountll(val);
#endif
}
/**