mirror of
https://github.com/RPCS3/rpcs3.git
synced 2025-07-10 17:01:24 +12:00
Replace utils::cntlz{32,64} with std::countl_zero
This commit is contained in:
parent
d0c199d455
commit
032e7c0491
11 changed files with 22 additions and 47 deletions
|
@ -4,30 +4,6 @@
|
|||
|
||||
namespace utils
|
||||
{
|
||||
inline u32 cntlz32(u32 arg, bool nonzero = false)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
ulong res;
|
||||
return _BitScanReverse(&res, arg) || nonzero ? res ^ 31 : 32;
|
||||
#elif __LZCNT__
|
||||
return _lzcnt_u32(arg);
|
||||
#else
|
||||
return arg || nonzero ? __builtin_clz(arg) : 32;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u64 cntlz64(u64 arg, bool nonzero = false)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
ulong res;
|
||||
return _BitScanReverse64(&res, arg) || nonzero ? res ^ 63 : 64;
|
||||
#elif __LZCNT__
|
||||
return _lzcnt_u64(arg);
|
||||
#else
|
||||
return arg || nonzero ? __builtin_clzll(arg) : 64;
|
||||
#endif
|
||||
}
|
||||
|
||||
inline u8 popcnt32(u32 arg)
|
||||
{
|
||||
#ifdef _MSC_VER
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue