[*] Clang/GCC AuBitScanReverse fix
This commit is contained in:
parent
c0977cbc0a
commit
34ebfb1f2e
@ -152,23 +152,41 @@ static auline bool AuBitScanReverse(AuUInt8 &index, T value)
|
||||
if (lower == 0)
|
||||
{
|
||||
ret = __builtin_clzl(static_cast<AuUInt32>(value & 0xffffffff)));
|
||||
ret += 32;
|
||||
ret = 63 - ret;
|
||||
}
|
||||
else
|
||||
{
|
||||
ret = __builtin_clzl(static_cast<AuUInt32>(lower));
|
||||
ret = 31 - ret;
|
||||
}
|
||||
#else
|
||||
ret = __builtin_clzll(static_cast<AuUInt64>(value));
|
||||
ret = 63 - ret;
|
||||
#endif
|
||||
}
|
||||
else if constexpr (sizeof(T) == sizeof(unsigned long))
|
||||
{
|
||||
ret = __builtin_clzl(static_cast<unsigned long>(value));
|
||||
if constexpr (sizeof(unsigned long) == 4)
|
||||
{
|
||||
ret = 31 - ret;
|
||||
}
|
||||
else if constexpr (sizeof(unsigned long) == 8)
|
||||
{
|
||||
ret = 63 - ret;
|
||||
}
|
||||
}
|
||||
else if constexpr (sizeof(T) == sizeof(unsigned int))
|
||||
{
|
||||
ret = __builtin_clz(static_cast<unsigned int>(value));
|
||||
if constexpr (sizeof(unsigned int) == 4)
|
||||
{
|
||||
ret = 31 - ret;
|
||||
}
|
||||
else if constexpr (sizeof(unsigned int) == 8)
|
||||
{
|
||||
ret = 63 - ret;
|
||||
}
|
||||
}
|
||||
|
||||
success = true;
|
||||
|
Loading…
Reference in New Issue
Block a user