mirror of
https://github.com/encounter/dawn-cmake.git
synced 2025-06-08 15:43:41 +00:00
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:
parent
a0ad53b618
commit
76dbbd54a0
@ -51,7 +51,7 @@ namespace backend {
|
|||||||
private:
|
private:
|
||||||
unsigned long getNextBit();
|
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;
|
std::bitset<N> mBits;
|
||||||
unsigned long mCurrentBit;
|
unsigned long mCurrentBit;
|
||||||
unsigned long mOffset;
|
unsigned long mOffset;
|
||||||
@ -110,10 +110,10 @@ namespace backend {
|
|||||||
|
|
||||||
template <size_t N, typename T>
|
template <size_t N, typename T>
|
||||||
unsigned long BitSetIterator<N, T>::Iterator::getNextBit() {
|
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) {
|
while (mOffset < N) {
|
||||||
unsigned long wordBits = (mBits & wordMask).to_ulong();
|
uint32_t wordBits = (mBits & wordMask).to_ulong();
|
||||||
if (wordBits != 0ul) {
|
if (wordBits != 0ul) {
|
||||||
return ScanForward(wordBits) + mOffset;
|
return ScanForward(wordBits) + mOffset;
|
||||||
}
|
}
|
||||||
|
Loading…
x
Reference in New Issue
Block a user