Make a static const variable constexpr in BitSetIterator
This was found during some changes in Google3.
Also renames BitsPerWord to kBitsPerWord.
Bug:
Change-Id: I80cfe3a391963c2da376a7d8eadfc2797df01894
Reviewed-on: https://dawn-review.googlesource.com/c/dawn/+/19286
Commit-Queue: Corentin Wallez <cwallez@chromium.org>
Reviewed-by: Austin Eng <enga@chromium.org>
diff --git a/src/common/BitSetIterator.h b/src/common/BitSetIterator.h
index 432433a..1a7fd60 100644
--- a/src/common/BitSetIterator.h
+++ b/src/common/BitSetIterator.h
@@ -51,7 +51,7 @@
private:
unsigned long getNextBit();
- static const size_t BitsPerWord = sizeof(uint32_t) * 8;
+ static constexpr size_t kBitsPerWord = sizeof(uint32_t) * 8;
std::bitset<N> mBits;
unsigned long mCurrentBit;
unsigned long mOffset;
@@ -88,7 +88,7 @@
if (bits.any()) {
mCurrentBit = getNextBit();
} else {
- mOffset = static_cast<unsigned long>(roundUp(N, BitsPerWord));
+ mOffset = static_cast<unsigned long>(roundUp(N, kBitsPerWord));
}
}
@@ -120,8 +120,8 @@
return ScanForward(wordBits) + mOffset;
}
- mBits >>= BitsPerWord;
- mOffset += BitsPerWord;
+ mBits >>= kBitsPerWord;
+ mOffset += kBitsPerWord;
}
return 0;
}