[tbb-commits] [tor-browser] 11/73: Bug 1768632: Make EnumSet compile for MSVC. r=glandium, a=RyanVM

gitolite role git at cupani.torproject.org
Wed Sep 21 20:17:04 UTC 2022


This is an automated email from the git hooks/post-receive script.

richard pushed a commit to branch geckoview-102.3.0esr-12.0-1
in repository tor-browser.

commit fb5e48a5f6bbf84fcbc84e9a8d55f3a1b291950f
Author: André Bargull <andre.bargull at gmail.com>
AuthorDate: Wed Aug 17 06:39:12 2022 +0000

    Bug 1768632: Make EnumSet compile for MSVC. r=glandium, a=RyanVM
    
    Differential Revision: https://phabricator.services.mozilla.com/D154338
---
 mfbt/BitSet.h             | 2 +-
 mfbt/EnumSet.h            | 8 ++++----
 mfbt/tests/TestBitSet.cpp | 6 +++---
 3 files changed, 8 insertions(+), 8 deletions(-)

diff --git a/mfbt/BitSet.h b/mfbt/BitSet.h
index fb4a4ea2195b3..7c03fb87ce6b9 100644
--- a/mfbt/BitSet.h
+++ b/mfbt/BitSet.h
@@ -75,7 +75,7 @@ class BitSet {
     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 {
     MOZ_ASSERT(aPos < N);
diff --git a/mfbt/EnumSet.h b/mfbt/EnumSet.h
index 929370918e06f..f7765c6f5c954 100644
--- a/mfbt/EnumSet.h
+++ b/mfbt/EnumSet.h
@@ -318,15 +318,15 @@ class EnumSet {
 #endif
   }
 
-  constexpr size_t MaxBits() const {
+  static constexpr size_t MaxBits() {
     if constexpr (std::is_unsigned_v<Serialized>) {
       return sizeof(Serialized) * 8;
     } else {
-      return mBitField.Size();
+      return Serialized::Size();
     }
-  };
+  }
 
-  static constexpr size_t kMaxBits = EnumSet().MaxBits();
+  static constexpr size_t kMaxBits = MaxBits();
 
   Serialized mBitField;
 
diff --git a/mfbt/tests/TestBitSet.cpp b/mfbt/tests/TestBitSet.cpp
index dd491b8dd55c7..2bd1923a15650 100644
--- a/mfbt/tests/TestBitSet.cpp
+++ b/mfbt/tests/TestBitSet.cpp
@@ -83,12 +83,12 @@ class BitSetSuite {
     MOZ_RELEASE_ASSERT(bitset[kBitsPerWord + 1]);
 
     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]);
     }
 
     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]);
     }
 
@@ -96,7 +96,7 @@ class BitSetSuite {
     MOZ_RELEASE_ASSERT(bitset.Storage()[1] == 3);
 
     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]);
     }
   }

-- 
To stop receiving notification emails like this one, please contact
the administrator of this repository.


More information about the tbb-commits mailing list