Use sized integer type for BitSetIterator

This makes sure it works correctly with the ScanForward Math type.
However this isn't a very good fix, the right solution would be to
detect whether we are compiling in 32bit or 64bit and use one of
ScanForward32 or ScanForward64.
This commit is contained in:
Corentin Wallez 2017-05-30 18:00:41 -04:00 committed by Corentin Wallez
parent a0ad53b618
commit 76dbbd54a0
1 changed files with 3 additions and 3 deletions

View File

@ -51,7 +51,7 @@ namespace backend {
private:
unsigned long getNextBit();
static const size_t BitsPerWord = sizeof(unsigned long) * 8;
static const size_t BitsPerWord = sizeof(uint32_t) * 8;
std::bitset<N> mBits;
unsigned long mCurrentBit;
unsigned long mOffset;
@ -110,10 +110,10 @@ namespace backend {
template <size_t N, typename T>
unsigned long BitSetIterator<N, T>::Iterator::getNextBit() {
static std::bitset<N> wordMask(std::numeric_limits<unsigned long>::max());
static std::bitset<N> wordMask(std::numeric_limits<uint32_t>::max());
while (mOffset < N) {
unsigned long wordBits = (mBits & wordMask).to_ulong();
uint32_t wordBits = (mBits & wordMask).to_ulong();
if (wordBits != 0ul) {
return ScanForward(wordBits) + mOffset;
}