forked from mirrors/gecko-dev
Bug 1768632: Make EnumSet compile for MSVC. r=glandium
Differential Revision: https://phabricator.services.mozilla.com/D154338
This commit is contained in:
parent
e07b2cf05a
commit
e9319e5454
3 changed files with 8 additions and 8 deletions
|
|
@ -75,7 +75,7 @@ class BitSet {
|
||||||
PodCopy(mStorage.begin(), aStorage.Elements(), kNumWords);
|
PodCopy(mStorage.begin(), aStorage.Elements(), kNumWords);
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t Size() const { return N; }
|
static constexpr size_t Size() { return N; }
|
||||||
|
|
||||||
constexpr bool Test(size_t aPos) const {
|
constexpr bool Test(size_t aPos) const {
|
||||||
MOZ_ASSERT(aPos < N);
|
MOZ_ASSERT(aPos < N);
|
||||||
|
|
|
||||||
|
|
@ -318,15 +318,15 @@ class EnumSet {
|
||||||
#endif
|
#endif
|
||||||
}
|
}
|
||||||
|
|
||||||
constexpr size_t MaxBits() const {
|
static constexpr size_t MaxBits() {
|
||||||
if constexpr (std::is_unsigned_v<Serialized>) {
|
if constexpr (std::is_unsigned_v<Serialized>) {
|
||||||
return sizeof(Serialized) * 8;
|
return sizeof(Serialized) * 8;
|
||||||
} else {
|
} else {
|
||||||
return mBitField.Size();
|
return Serialized::Size();
|
||||||
}
|
}
|
||||||
};
|
}
|
||||||
|
|
||||||
static constexpr size_t kMaxBits = EnumSet().MaxBits();
|
static constexpr size_t kMaxBits = MaxBits();
|
||||||
|
|
||||||
Serialized mBitField;
|
Serialized mBitField;
|
||||||
|
|
||||||
|
|
|
||||||
|
|
@ -83,12 +83,12 @@ class BitSetSuite {
|
||||||
MOZ_RELEASE_ASSERT(bitset[kBitsPerWord + 1]);
|
MOZ_RELEASE_ASSERT(bitset[kBitsPerWord + 1]);
|
||||||
|
|
||||||
bitset.ResetAll();
|
bitset.ResetAll();
|
||||||
for (size_t i = 0; i < bitset.Size(); i++) {
|
for (size_t i = 0; i < decltype(bitset)::Size(); i++) {
|
||||||
MOZ_RELEASE_ASSERT(!bitset[i]);
|
MOZ_RELEASE_ASSERT(!bitset[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
bitset.SetAll();
|
bitset.SetAll();
|
||||||
for (size_t i = 0; i < bitset.Size(); i++) {
|
for (size_t i = 0; i < decltype(bitset)::Size(); i++) {
|
||||||
MOZ_RELEASE_ASSERT(bitset[i]);
|
MOZ_RELEASE_ASSERT(bitset[i]);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
@ -96,7 +96,7 @@ class BitSetSuite {
|
||||||
MOZ_RELEASE_ASSERT(bitset.Storage()[1] == 3);
|
MOZ_RELEASE_ASSERT(bitset.Storage()[1] == 3);
|
||||||
|
|
||||||
bitset.ResetAll();
|
bitset.ResetAll();
|
||||||
for (size_t i = 0; i < bitset.Size(); i++) {
|
for (size_t i = 0; i < decltype(bitset)::Size(); i++) {
|
||||||
MOZ_RELEASE_ASSERT(!bitset[i]);
|
MOZ_RELEASE_ASSERT(!bitset[i]);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
||||||
Loading…
Reference in a new issue