mirror of
https://github.com/yuzu-emu/unicorn.git
synced 2025-07-23 01:28:18 +00:00
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:
parent
4e605ba038
commit
0de4a47169
|
@ -292,7 +292,11 @@ static inline int clrsb64(uint64_t val)
|
||||||
*/
|
*/
|
||||||
static inline int ctpop8(uint8_t val)
|
static inline int ctpop8(uint8_t val)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return __popcnt(val);
|
||||||
|
#else
|
||||||
return __builtin_popcount(val);
|
return __builtin_popcount(val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -301,7 +305,11 @@ static inline int ctpop8(uint8_t val)
|
||||||
*/
|
*/
|
||||||
static inline int ctpop16(uint16_t val)
|
static inline int ctpop16(uint16_t val)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return __popcnt(val);
|
||||||
|
#else
|
||||||
return __builtin_popcount(val);
|
return __builtin_popcount(val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -310,7 +318,11 @@ static inline int ctpop16(uint16_t val)
|
||||||
*/
|
*/
|
||||||
static inline int ctpop32(uint32_t val)
|
static inline int ctpop32(uint32_t val)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return __popcnt(val);
|
||||||
|
#else
|
||||||
return __builtin_popcount(val);
|
return __builtin_popcount(val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -319,7 +331,11 @@ static inline int ctpop32(uint32_t val)
|
||||||
*/
|
*/
|
||||||
static inline int ctpop64(uint64_t val)
|
static inline int ctpop64(uint64_t val)
|
||||||
{
|
{
|
||||||
|
#ifdef _MSC_VER
|
||||||
|
return __popcnt64(val);
|
||||||
|
#else
|
||||||
return __builtin_popcountll(val);
|
return __builtin_popcountll(val);
|
||||||
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
Loading…
Reference in a new issue