[*] Fix CpuBitScanForward
This commit is contained in:
parent
e802b4c1d5
commit
db24cb2c5b
@ -46,19 +46,24 @@ namespace Aurora::HWInfo
|
||||
|
||||
bool CpuBitId::CpuBitScanForward(AuUInt8 &index, AuUInt8 offset) const
|
||||
{
|
||||
AuUInt8 tempIndex = index;
|
||||
|
||||
#if defined(_AU_MASSIVE_CPUID)
|
||||
if (offset >= 192)
|
||||
{
|
||||
if (!AuBitScanForward(index, AuUInt64(upper3) >> AuUInt64(offset - 192))) return false;
|
||||
index += 192;
|
||||
if (!AuBitScanForward(tempIndex, AuUInt64(upper3) >> AuUInt64(offset - 192)))
|
||||
{
|
||||
return false;
|
||||
}
|
||||
tempIndex += (192 + offset);
|
||||
}
|
||||
else if (offset >= 128)
|
||||
{
|
||||
if (!AuBitScanForward(index, AuUInt64(upper2) >> AuUInt64(offset - 128)))
|
||||
if (!AuBitScanForward(tempIndex, AuUInt64(upper2) >> AuUInt64(offset - 128)))
|
||||
{
|
||||
return CpuBitScanForward(index, 128);
|
||||
}
|
||||
index += 128;
|
||||
tempIndex += (128 + offset);
|
||||
}
|
||||
#else
|
||||
if (offset >= 128)
|
||||
@ -68,20 +73,22 @@ namespace Aurora::HWInfo
|
||||
#endif
|
||||
else if (offset >= 64)
|
||||
{
|
||||
if (!AuBitScanForward(index, AuUInt64(upper) >> AuUInt64(offset - 64)))
|
||||
if (!AuBitScanForward(tempIndex, AuUInt64(upper) >> AuUInt64(offset - 64)))
|
||||
{
|
||||
return CpuBitScanForward(index, 128);
|
||||
}
|
||||
index += 64;
|
||||
tempIndex += (64 + offset);
|
||||
}
|
||||
else
|
||||
{
|
||||
if (!AuBitScanForward(index, AuUInt64(lower) >> AuUInt64(offset)))
|
||||
if (!AuBitScanForward(tempIndex, AuUInt64(lower) >> AuUInt64(offset)))
|
||||
{
|
||||
return CpuBitScanForward(index, 64);
|
||||
}
|
||||
tempIndex += offset;
|
||||
}
|
||||
|
||||
index = tempIndex;
|
||||
return true;
|
||||
}
|
||||
|
||||
|
Loading…
Reference in New Issue
Block a user