Core/Bitset: Fix infinite loop

Former-commit-id: 366ad4248a72e3e06637163b44a9a5cedbbaf195
This commit is contained in:
Lynix 2016-05-09 18:10:46 +02:00
parent 7db8507874
commit 34bc2301a0
1 changed files with 2 additions and 5 deletions

View File

@ -126,13 +126,10 @@ namespace Nz
else
{
// Note: I was kinda tired when I wrote this, there's probably a much easier method than checking bits to write bits
unsigned int bitPos = 0;
for (T bit = 1; bit < std::numeric_limits<T>::max(); bit <<= 1)
for (unsigned int bitPos = 0; bitPos < std::numeric_limits<T>::digits; bitPos++)
{
if (value & bit)
if (value & (T(1U) << bitPos))
UnboundedSet(bitPos, true);
bitPos++;
}
}
}