summaryrefslogtreecommitdiff
path: root/src/flag_set.hpp
diff options
context:
space:
mode:
Diffstat (limited to 'src/flag_set.hpp')
-rw-r--r--src/flag_set.hpp9
1 files changed, 9 insertions, 0 deletions
diff --git a/src/flag_set.hpp b/src/flag_set.hpp
index 2e5d46ea..b4bdc92f 100644
--- a/src/flag_set.hpp
+++ b/src/flag_set.hpp
@@ -16,6 +16,9 @@ private:
std::uint32_t m_data[tiers];
public:
+ static constexpr const std::size_t nbits = tiers * 32;
+
+public:
constexpr flag_set()
: m_data { 0 }
@@ -81,6 +84,12 @@ public:
return !empty();
}
+ constexpr bool bit(std::size_t i) const
+ {
+ assert(i < nbits);
+ return (m_data[i / 32] & (1UL << (i % 32)));
+ }
+
flag_set &operator |= (flag_set const &other)
{
for (std::size_t i = 0; i < tiers; i++)