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>
This commit is contained in:
Corentin Wallez 2020-04-14 18:15:14 +00:00 committed by Commit Bot service account
parent 797fa62b91
commit 4bfc1539c3
1 changed files with 4 additions and 4 deletions

View File

@ -51,7 +51,7 @@ class BitSetIterator final {
private: private:
unsigned long getNextBit(); 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; std::bitset<N> mBits;
unsigned long mCurrentBit; unsigned long mCurrentBit;
unsigned long mOffset; unsigned long mOffset;
@ -88,7 +88,7 @@ BitSetIterator<N, T>::Iterator::Iterator(const std::bitset<N>& bits)
if (bits.any()) { if (bits.any()) {
mCurrentBit = getNextBit(); mCurrentBit = getNextBit();
} else { } else {
mOffset = static_cast<unsigned long>(roundUp(N, BitsPerWord)); mOffset = static_cast<unsigned long>(roundUp(N, kBitsPerWord));
} }
} }
@ -120,8 +120,8 @@ unsigned long BitSetIterator<N, T>::Iterator::getNextBit() {
return ScanForward(wordBits) + mOffset; return ScanForward(wordBits) + mOffset;
} }
mBits >>= BitsPerWord; mBits >>= kBitsPerWord;
mOffset += BitsPerWord; mOffset += kBitsPerWord;
} }
return 0; return 0;
} }