Skip to content

Commit

Permalink
Merge pull request #11491 from lioncash/set
Browse files Browse the repository at this point in the history
Common/BitSet: Mark initializer_list constructor as constexpr
  • Loading branch information
AdmiralCurtiss authored Jan 25, 2023
2 parents 6db2171 + 0d93a31 commit 70b2a67
Showing 1 changed file with 3 additions and 4 deletions.
7 changes: 3 additions & 4 deletions Source/Core/Common/BitSet.h
Original file line number Diff line number Diff line change
Expand Up @@ -93,11 +93,10 @@ class BitSet
int m_bit;
};

constexpr BitSet() : m_val(0) {}
constexpr BitSet() = default;
constexpr explicit BitSet(IntTy val) : m_val(val) {}
BitSet(std::initializer_list<int> init)
constexpr BitSet(std::initializer_list<int> init)
{
m_val = 0;
for (int bit : init)
m_val |= (IntTy)1 << bit;
}
Expand Down Expand Up @@ -132,7 +131,7 @@ class BitSet
constexpr unsigned int Count() const { return std::popcount(m_val); }
constexpr Iterator begin() const { return ++Iterator(m_val, 0); }
constexpr Iterator end() const { return Iterator(m_val, -1); }
IntTy m_val;
IntTy m_val{};
};
} // namespace Common

Expand Down

0 comments on commit 70b2a67

Please sign in to comment.