From 4bfc1539c391c8b80c2a9d034d5e959be531119c Mon Sep 17 00:00:00 2001 From: Corentin Wallez Date: Tue, 14 Apr 2020 18:15:14 +0000 Subject: [PATCH] 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 Reviewed-by: Austin Eng --- src/common/BitSetIterator.h | 8 ++++---- 1 file changed, 4 insertions(+), 4 deletions(-) diff --git a/src/common/BitSetIterator.h b/src/common/BitSetIterator.h index 432433a940..1a7fd60696 100644 --- a/src/common/BitSetIterator.h +++ b/src/common/BitSetIterator.h @@ -51,7 +51,7 @@ class BitSetIterator final { private: unsigned long getNextBit(); - static const size_t BitsPerWord = sizeof(uint32_t) * 8; + static constexpr size_t kBitsPerWord = sizeof(uint32_t) * 8; std::bitset mBits; unsigned long mCurrentBit; unsigned long mOffset; @@ -88,7 +88,7 @@ BitSetIterator::Iterator::Iterator(const std::bitset& bits) if (bits.any()) { mCurrentBit = getNextBit(); } else { - mOffset = static_cast(roundUp(N, BitsPerWord)); + mOffset = static_cast(roundUp(N, kBitsPerWord)); } } @@ -120,8 +120,8 @@ unsigned long BitSetIterator::Iterator::getNextBit() { return ScanForward(wordBits) + mOffset; } - mBits >>= BitsPerWord; - mOffset += BitsPerWord; + mBits >>= kBitsPerWord; + mOffset += kBitsPerWord; } return 0; }