/root/bitcoin/src/util/bitset.h
Line | Count | Source |
1 | | // Copyright (c) The Bitcoin Core developers |
2 | | // Distributed under the MIT software license, see the accompanying |
3 | | // file COPYING or http://www.opensource.org/licenses/mit-license.php. |
4 | | |
5 | | #ifndef BITCOIN_UTIL_BITSET_H |
6 | | #define BITCOIN_UTIL_BITSET_H |
7 | | |
8 | | #include <util/check.h> |
9 | | #include <util/overflow.h> |
10 | | |
11 | | #include <array> |
12 | | #include <bit> |
13 | | #include <cstdint> |
14 | | #include <limits> |
15 | | #include <type_traits> |
16 | | |
17 | | /* This file provides data types similar to std::bitset, but adds the following functionality: |
18 | | * |
19 | | * - Efficient iteration over all set bits (compatible with range-based for loops). |
20 | | * - Efficient search for the first and last set bit (First() and Last()). |
21 | | * - Efficient set subtraction: (a - b) implements "a and not b". |
22 | | * - Efficient non-strict subset/superset testing: IsSubsetOf() and IsSupersetOf(). |
23 | | * - Efficient set overlap testing: a.Overlaps(b) |
24 | | * - Efficient construction of set containing 0..N-1 (S::Fill). |
25 | | * - Efficient construction of a single set (S::Singleton). |
26 | | * - Construction from initializer lists. |
27 | | * |
28 | | * Other differences: |
29 | | * - BitSet<N> is a bitset that supports at least N elements, but may support more (Size() reports |
30 | | * the actual number). Because the actual number is unpredictable, there are no operations that |
31 | | * affect all positions (like std::bitset's operator~, flip(), or all()). |
32 | | * - Various other unimplemented features. |
33 | | */ |
34 | | |
35 | | namespace bitset_detail { |
36 | | |
37 | | /** Count the number of bits set in an unsigned integer type. */ |
38 | | template<typename I> |
39 | | unsigned inline constexpr PopCount(I v) |
40 | 0 | { |
41 | 0 | static_assert(std::is_integral_v<I> && std::is_unsigned_v<I> && std::numeric_limits<I>::radix == 2); |
42 | 0 | constexpr auto BITS = std::numeric_limits<I>::digits; |
43 | | // Algorithms from https://en.wikipedia.org/wiki/Hamming_weight#Efficient_implementation. |
44 | | // These seem to be faster than std::popcount when compiling for non-SSE4 on x86_64. |
45 | 0 | if constexpr (BITS <= 32) { |
46 | 0 | v -= (v >> 1) & 0x55555555; |
47 | 0 | v = (v & 0x33333333) + ((v >> 2) & 0x33333333); |
48 | 0 | v = (v + (v >> 4)) & 0x0f0f0f0f; |
49 | 0 | if constexpr (BITS > 8) v += v >> 8; |
50 | 0 | if constexpr (BITS > 16) v += v >> 16; |
51 | 0 | return v & 0x3f; |
52 | 0 | } else { |
53 | 0 | static_assert(BITS <= 64); |
54 | 0 | v -= (v >> 1) & 0x5555555555555555; |
55 | 0 | v = (v & 0x3333333333333333) + ((v >> 2) & 0x3333333333333333); |
56 | 0 | v = (v + (v >> 4)) & 0x0f0f0f0f0f0f0f0f; |
57 | 0 | return (v * uint64_t{0x0101010101010101}) >> 56; |
58 | 0 | } |
59 | 0 | } Unexecuted instantiation: _ZN13bitset_detail8PopCountItEEjT_ Unexecuted instantiation: _ZN13bitset_detail8PopCountIjEEjT_ Unexecuted instantiation: _ZN13bitset_detail8PopCountImEEjT_ |
60 | | |
61 | | /** A bitset implementation backed by a single integer of type I. */ |
62 | | template<typename I> |
63 | | class IntBitSet |
64 | | { |
65 | | // Only binary, unsigned, integer, types allowed. |
66 | | static_assert(std::is_integral_v<I> && std::is_unsigned_v<I> && std::numeric_limits<I>::radix == 2); |
67 | | /** The maximum number of bits this bitset supports. */ |
68 | | static constexpr unsigned MAX_SIZE = std::numeric_limits<I>::digits; |
69 | | /** Integer whose bits represent this bitset. */ |
70 | | I m_val; |
71 | | /** Internal constructor with a given integer as contents. */ |
72 | 0 | IntBitSet(I val) noexcept : m_val{val} {}Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEC2Et Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEC2Ej Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEC2Em |
73 | | /** Dummy type to return using end(). Only used for comparing with Iterator. */ |
74 | | class IteratorEnd |
75 | | { |
76 | | friend class IntBitSet; |
77 | | constexpr IteratorEnd() = default; |
78 | | public: |
79 | | constexpr IteratorEnd(const IteratorEnd&) = default; |
80 | | }; |
81 | | /** Iterator type returned by begin(), which efficiently iterates all 1 positions. */ |
82 | | class Iterator |
83 | | { |
84 | | friend class IntBitSet; |
85 | | I m_val; /**< The original integer's remaining bits. */ |
86 | | unsigned m_pos; /** Last reported 1 position (if m_pos != 0). */ |
87 | 0 | constexpr Iterator(I val) noexcept : m_val(val), m_pos(0) |
88 | 0 | { |
89 | 0 | if (m_val != 0) m_pos = std::countr_zero(m_val); Branch (89:17): [True: 0, False: 0]
Branch (89:17): [True: 0, False: 0]
Branch (89:17): [True: 0, False: 0]
|
90 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE8IteratorC2Et Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE8IteratorC2Ej Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE8IteratorC2Em |
91 | | public: |
92 | | /** Do not allow external code to construct an Iterator. */ |
93 | | Iterator() = delete; |
94 | | // Copying is allowed. |
95 | | constexpr Iterator(const Iterator&) noexcept = default; |
96 | | constexpr Iterator& operator=(const Iterator&) noexcept = default; |
97 | | /** Test whether we are done (can only compare with IteratorEnd). */ |
98 | | constexpr friend bool operator==(const Iterator& a, const IteratorEnd&) noexcept |
99 | 0 | { |
100 | 0 | return a.m_val == 0; |
101 | 0 | } Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetItE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetIjE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetImE8IteratorERKNS1_11IteratorEndE |
102 | | /** Progress to the next 1 bit (only if != IteratorEnd). */ |
103 | | constexpr Iterator& operator++() noexcept |
104 | 0 | { |
105 | 0 | Assume(m_val != 0); |
106 | 0 | m_val &= m_val - I{1U}; |
107 | 0 | if (m_val != 0) m_pos = std::countr_zero(m_val); Branch (107:17): [True: 0, False: 0]
Branch (107:17): [True: 0, False: 0]
Branch (107:17): [True: 0, False: 0]
|
108 | 0 | return *this; |
109 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE8IteratorppEv |
110 | | /** Get the current bit position (only if != IteratorEnd). */ |
111 | | constexpr unsigned operator*() const noexcept |
112 | 0 | { |
113 | 0 | Assume(m_val != 0); |
114 | 0 | return m_pos; |
115 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE8IteratordeEv |
116 | | }; |
117 | | |
118 | | public: |
119 | | /** Construct an all-zero bitset. */ |
120 | 0 | constexpr IntBitSet() noexcept : m_val{0} {}Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEC2Ev Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEC2Ev Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEC2Ev |
121 | | /** Copy construct a bitset. */ |
122 | | constexpr IntBitSet(const IntBitSet&) noexcept = default; |
123 | | /** Construct from a list of values. */ |
124 | 0 | constexpr IntBitSet(std::initializer_list<unsigned> ilist) noexcept : m_val(0) |
125 | 0 | { |
126 | 0 | for (auto pos : ilist) Set(pos); Branch (126:23): [True: 0, False: 0]
Branch (126:23): [True: 0, False: 0]
Branch (126:23): [True: 0, False: 0]
|
127 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEC2ESt16initializer_listIjE |
128 | | /** Copy assign a bitset. */ |
129 | | constexpr IntBitSet& operator=(const IntBitSet&) noexcept = default; |
130 | | /** Assign from a list of positions (which will be made true, all others false). */ |
131 | | constexpr IntBitSet& operator=(std::initializer_list<unsigned> ilist) noexcept |
132 | 0 | { |
133 | 0 | m_val = 0; |
134 | 0 | for (auto pos : ilist) Set(pos); Branch (134:23): [True: 0, False: 0]
Branch (134:23): [True: 0, False: 0]
Branch (134:23): [True: 0, False: 0]
|
135 | 0 | return *this; |
136 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEaSESt16initializer_listIjE |
137 | | /** Construct a bitset with the singleton i. */ |
138 | | static constexpr IntBitSet Singleton(unsigned i) noexcept |
139 | 0 | { |
140 | 0 | Assume(i < MAX_SIZE); |
141 | 0 | return IntBitSet(I(1U) << i); |
142 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE9SingletonEj |
143 | | /** Construct a bitset with bits 0..count-1 (inclusive) set to 1. */ |
144 | | static constexpr IntBitSet Fill(unsigned count) noexcept |
145 | 0 | { |
146 | 0 | IntBitSet ret; |
147 | 0 | Assume(count <= MAX_SIZE); |
148 | 0 | if (count) ret.m_val = I(~I{0}) >> (MAX_SIZE - count); Branch (148:13): [True: 0, False: 0]
Branch (148:13): [True: 0, False: 0]
Branch (148:13): [True: 0, False: 0]
|
149 | 0 | return ret; |
150 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE4FillEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE4FillEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE4FillEj |
151 | | /** Set a bit to 1. */ |
152 | | constexpr void Set(unsigned pos) noexcept |
153 | 0 | { |
154 | 0 | Assume(pos < MAX_SIZE); |
155 | 0 | m_val |= I{1U} << pos; |
156 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE3SetEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE3SetEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE3SetEj |
157 | | /** Set a bit to the specified value. */ |
158 | | constexpr void Set(unsigned pos, bool val) noexcept |
159 | 0 | { |
160 | 0 | Assume(pos < MAX_SIZE); |
161 | 0 | m_val = (m_val & ~I(I{1U} << pos)) | (I(val) << pos); |
162 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE3SetEjb Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE3SetEjb Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE3SetEjb |
163 | | /** Set a bit to 0. */ |
164 | | constexpr void Reset(unsigned pos) noexcept |
165 | 0 | { |
166 | 0 | Assume(pos < MAX_SIZE); |
167 | 0 | m_val &= ~I(I{1U} << pos); |
168 | 0 | } Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE5ResetEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE5ResetEj Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE5ResetEj |
169 | | /** Retrieve a bit at the given position. */ |
170 | | constexpr bool operator[](unsigned pos) const noexcept |
171 | 0 | { |
172 | 0 | Assume(pos < MAX_SIZE); |
173 | 0 | return (m_val >> pos) & 1U; |
174 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItEixEj Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjEixEj Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImEixEj |
175 | | /** Compute the number of 1 bits in the bitset. */ |
176 | 0 | constexpr unsigned Count() const noexcept { return PopCount(m_val); }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE5CountEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE5CountEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE5CountEv |
177 | | /** Return the number of bits that this object holds. */ |
178 | 0 | static constexpr unsigned Size() noexcept { return MAX_SIZE; }Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItE4SizeEv Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjE4SizeEv Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImE4SizeEv |
179 | | /** Check if all bits are 0. */ |
180 | 0 | constexpr bool None() const noexcept { return m_val == 0; }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE4NoneEv |
181 | | /** Check if any bits are 1. */ |
182 | 0 | constexpr bool Any() const noexcept { return !None(); }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE3AnyEv |
183 | | /** Return an object that iterates over all 1 bits (++ and * only allowed when != end()). */ |
184 | 0 | constexpr Iterator begin() const noexcept { return Iterator(m_val); }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE5beginEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE5beginEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE5beginEv |
185 | | /** Return a dummy object to compare Iterators with. */ |
186 | 0 | constexpr IteratorEnd end() const noexcept { return IteratorEnd(); }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE3endEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE3endEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE3endEv |
187 | | /** Find the first element (requires Any()). */ |
188 | | constexpr unsigned First() const noexcept |
189 | 0 | { |
190 | 0 | Assume(m_val != 0); |
191 | 0 | return std::countr_zero(m_val); |
192 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE5FirstEv |
193 | | /** Find the last element (requires Any()). */ |
194 | | constexpr unsigned Last() const noexcept |
195 | 0 | { |
196 | 0 | Assume(m_val != 0); |
197 | 0 | return std::bit_width(m_val) - 1; |
198 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE4LastEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE4LastEv Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE4LastEv |
199 | | /** Set this object's bits to be the binary AND between respective bits from this and a. */ |
200 | 0 | constexpr IntBitSet& operator|=(const IntBitSet& a) noexcept { m_val |= a.m_val; return *this; }Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEoRERKS1_ |
201 | | /** Set this object's bits to be the binary OR between respective bits from this and a. */ |
202 | 0 | constexpr IntBitSet& operator&=(const IntBitSet& a) noexcept { m_val &= a.m_val; return *this; }Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEaNERKS1_ |
203 | | /** Set this object's bits to be the binary AND NOT between respective bits from this and a. */ |
204 | 0 | constexpr IntBitSet& operator-=(const IntBitSet& a) noexcept { m_val &= ~a.m_val; return *this; }Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEmIERKS1_ |
205 | | /** Set this object's bits to be the binary XOR between respective bits from this as a. */ |
206 | 0 | constexpr IntBitSet& operator^=(const IntBitSet& a) noexcept { m_val ^= a.m_val; return *this; }Unexecuted instantiation: _ZN13bitset_detail9IntBitSetItEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetIjEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail9IntBitSetImEeOERKS1_ |
207 | | /** Check if the intersection between two sets is non-empty. */ |
208 | 0 | constexpr bool Overlaps(const IntBitSet& a) const noexcept { return m_val & a.m_val; }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE8OverlapsERKS1_ |
209 | | /** Return an object with the binary AND between respective bits from a and b. */ |
210 | 0 | friend constexpr IntBitSet operator&(const IntBitSet& a, const IntBitSet& b) noexcept { return I(a.m_val & b.m_val); }Unexecuted instantiation: _ZN13bitset_detailanERKNS_9IntBitSetItEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_9IntBitSetIjEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_9IntBitSetImEES3_ |
211 | | /** Return an object with the binary OR between respective bits from a and b. */ |
212 | 0 | friend constexpr IntBitSet operator|(const IntBitSet& a, const IntBitSet& b) noexcept { return I(a.m_val | b.m_val); }Unexecuted instantiation: _ZN13bitset_detailorERKNS_9IntBitSetItEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_9IntBitSetIjEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_9IntBitSetImEES3_ |
213 | | /** Return an object with the binary AND NOT between respective bits from a and b. */ |
214 | 0 | friend constexpr IntBitSet operator-(const IntBitSet& a, const IntBitSet& b) noexcept { return I(a.m_val & ~b.m_val); }Unexecuted instantiation: _ZN13bitset_detailmiERKNS_9IntBitSetItEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_9IntBitSetIjEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_9IntBitSetImEES3_ |
215 | | /** Return an object with the binary XOR between respective bits from a and b. */ |
216 | 0 | friend constexpr IntBitSet operator^(const IntBitSet& a, const IntBitSet& b) noexcept { return I(a.m_val ^ b.m_val); }Unexecuted instantiation: _ZN13bitset_detaileoERKNS_9IntBitSetItEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_9IntBitSetIjEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_9IntBitSetImEES3_ |
217 | | /** Check if bitset a and bitset b are identical. */ |
218 | 0 | friend constexpr bool operator==(const IntBitSet& a, const IntBitSet& b) noexcept = default; Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetItEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetIjEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_9IntBitSetImEES3_ |
219 | | /** Check if bitset a is a superset of bitset b (= every 1 bit in b is also in a). */ |
220 | 0 | constexpr bool IsSupersetOf(const IntBitSet& a) const noexcept { return (a.m_val & ~m_val) == 0; }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE12IsSupersetOfERKS1_ |
221 | | /** Check if bitset a is a subset of bitset b (= every 1 bit in a is also in b). */ |
222 | 0 | constexpr bool IsSubsetOf(const IntBitSet& a) const noexcept { return (m_val & ~a.m_val) == 0; }Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetItE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetIjE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail9IntBitSetImE10IsSubsetOfERKS1_ |
223 | | /** Swap two bitsets. */ |
224 | 0 | friend constexpr void swap(IntBitSet& a, IntBitSet& b) noexcept { std::swap(a.m_val, b.m_val); }Unexecuted instantiation: _ZN13bitset_detail4swapERNS_9IntBitSetItEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_9IntBitSetIjEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_9IntBitSetImEES2_ |
225 | | }; |
226 | | |
227 | | /** A bitset implementation backed by N integers of type I. */ |
228 | | template<typename I, unsigned N> |
229 | | class MultiIntBitSet |
230 | | { |
231 | | // Only binary, unsigned, integer, types allowed. |
232 | | static_assert(std::is_integral_v<I> && std::is_unsigned_v<I> && std::numeric_limits<I>::radix == 2); |
233 | | // Cannot be empty. |
234 | | static_assert(N > 0); |
235 | | /** The number of bits per integer. */ |
236 | | static constexpr unsigned LIMB_BITS = std::numeric_limits<I>::digits; |
237 | | /** Number of elements this set type supports. */ |
238 | | static constexpr unsigned MAX_SIZE = LIMB_BITS * N; |
239 | | // No overflow allowed here. |
240 | | static_assert(MAX_SIZE / LIMB_BITS == N); |
241 | | /** Array whose member integers store the bits of the set. */ |
242 | | std::array<I, N> m_val; |
243 | | /** Dummy type to return using end(). Only used for comparing with Iterator. */ |
244 | | class IteratorEnd |
245 | | { |
246 | | friend class MultiIntBitSet; |
247 | | constexpr IteratorEnd() = default; |
248 | | public: |
249 | | constexpr IteratorEnd(const IteratorEnd&) = default; |
250 | | }; |
251 | | /** Iterator type returned by begin(), which efficiently iterates all 1 positions. */ |
252 | | class Iterator |
253 | | { |
254 | | friend class MultiIntBitSet; |
255 | | const std::array<I, N>* m_ptr; /**< Pointer to array to fetch bits from. */ |
256 | | I m_val; /**< The remaining bits of (*m_ptr)[m_idx]. */ |
257 | | unsigned m_pos; /**< The last reported position. */ |
258 | | unsigned m_idx; /**< The index in *m_ptr currently being iterated over. */ |
259 | 0 | constexpr Iterator(const std::array<I, N>& ref) noexcept : m_ptr(&ref), m_idx(0) |
260 | 0 | { |
261 | 0 | do { |
262 | 0 | m_val = (*m_ptr)[m_idx]; |
263 | 0 | if (m_val) { Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
Branch (263:21): [True: 0, False: 0]
|
264 | 0 | m_pos = std::countr_zero(m_val) + m_idx * LIMB_BITS; |
265 | 0 | break; |
266 | 0 | } |
267 | 0 | ++m_idx; |
268 | 0 | } while(m_idx < N); Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
Branch (268:21): [True: 0, False: 0]
|
269 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE8IteratorC2ERKSt5arrayItLm1EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE8IteratorC2ERKSt5arrayItLm2EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE8IteratorC2ERKSt5arrayItLm3EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE8IteratorC2ERKSt5arrayImLm1EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE8IteratorC2ERKSt5arrayIjLm2EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE8IteratorC2ERKSt5arrayItLm4EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE8IteratorC2ERKSt5arrayIjLm3EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE8IteratorC2ERKSt5arrayImLm2EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE8IteratorC2ERKSt5arrayIjLm4EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE8IteratorC2ERKSt5arrayImLm3EE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE8IteratorC2ERKSt5arrayImLm4EE |
270 | | |
271 | | public: |
272 | | /** Do not allow external code to construct an Iterator. */ |
273 | | Iterator() = delete; |
274 | | // Copying is allowed. |
275 | | constexpr Iterator(const Iterator&) noexcept = default; |
276 | | constexpr Iterator& operator=(const Iterator&) noexcept = default; |
277 | | /** Test whether we are done (can only compare with IteratorEnd). */ |
278 | | friend constexpr bool operator==(const Iterator& a, const IteratorEnd&) noexcept |
279 | 0 | { |
280 | 0 | return a.m_idx == N; |
281 | 0 | } Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj1EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj2EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj3EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj1EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj2EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj4EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj3EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj2EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj4EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj3EE8IteratorERKNS1_11IteratorEndE Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj4EE8IteratorERKNS1_11IteratorEndE |
282 | | /** Progress to the next 1 bit (only if != IteratorEnd). */ |
283 | | constexpr Iterator& operator++() noexcept |
284 | 0 | { |
285 | 0 | Assume(m_idx < N); |
286 | 0 | m_val &= m_val - I{1U}; |
287 | 0 | if (m_val == 0) { Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
Branch (287:17): [True: 0, False: 0]
|
288 | 0 | while (true) { Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
Branch (288:24): [Folded - Ignored]
|
289 | 0 | ++m_idx; |
290 | 0 | if (m_idx == N) break; Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
Branch (290:25): [True: 0, False: 0]
|
291 | 0 | m_val = (*m_ptr)[m_idx]; |
292 | 0 | if (m_val) { Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
Branch (292:25): [True: 0, False: 0]
|
293 | 0 | m_pos = std::countr_zero(m_val) + m_idx * LIMB_BITS; |
294 | 0 | break; |
295 | 0 | } |
296 | 0 | } |
297 | 0 | } else { |
298 | 0 | m_pos = std::countr_zero(m_val) + m_idx * LIMB_BITS; |
299 | 0 | } |
300 | 0 | return *this; |
301 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE8IteratorppEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE8IteratorppEv |
302 | | /** Get the current bit position (only if != IteratorEnd). */ |
303 | | constexpr unsigned operator*() const noexcept |
304 | 0 | { |
305 | 0 | Assume(m_idx < N); |
306 | 0 | return m_pos; |
307 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE8IteratordeEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE8IteratordeEv |
308 | | }; |
309 | | |
310 | | public: |
311 | | /** Construct an all-zero bitset. */ |
312 | 0 | constexpr MultiIntBitSet() noexcept : m_val{} {}Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEC2Ev Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEC2Ev |
313 | | /** Copy construct a bitset. */ |
314 | | constexpr MultiIntBitSet(const MultiIntBitSet&) noexcept = default; |
315 | | /** Copy assign a bitset. */ |
316 | | constexpr MultiIntBitSet& operator=(const MultiIntBitSet&) noexcept = default; |
317 | | /** Set a bit to 1. */ |
318 | | void constexpr Set(unsigned pos) noexcept |
319 | 0 | { |
320 | 0 | Assume(pos < MAX_SIZE); |
321 | 0 | m_val[pos / LIMB_BITS] |= I{1U} << (pos % LIMB_BITS); |
322 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE3SetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE3SetEj |
323 | | /** Set a bit to the specified value. */ |
324 | | void constexpr Set(unsigned pos, bool val) noexcept |
325 | 0 | { |
326 | 0 | Assume(pos < MAX_SIZE); |
327 | 0 | m_val[pos / LIMB_BITS] = (m_val[pos / LIMB_BITS] & ~I(I{1U} << (pos % LIMB_BITS))) | |
328 | 0 | (I{val} << (pos % LIMB_BITS)); |
329 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE3SetEjb Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE3SetEjb |
330 | | /** Construct a bitset from a list of values. */ |
331 | 0 | constexpr MultiIntBitSet(std::initializer_list<unsigned> ilist) noexcept : m_val{} |
332 | 0 | { |
333 | 0 | for (auto pos : ilist) Set(pos); Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
Branch (333:23): [True: 0, False: 0]
|
334 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEC2ESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEC2ESt16initializer_listIjE |
335 | | /** Set a bitset to a list of values. */ |
336 | | constexpr MultiIntBitSet& operator=(std::initializer_list<unsigned> ilist) noexcept |
337 | 0 | { |
338 | 0 | m_val.fill(0); |
339 | 0 | for (auto pos : ilist) Set(pos); Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
Branch (339:23): [True: 0, False: 0]
|
340 | 0 | return *this; |
341 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEaSESt16initializer_listIjE Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEaSESt16initializer_listIjE |
342 | | /** Set a bit to 0. */ |
343 | | void constexpr Reset(unsigned pos) noexcept |
344 | 0 | { |
345 | 0 | Assume(pos < MAX_SIZE); |
346 | 0 | m_val[pos / LIMB_BITS] &= ~I(I{1U} << (pos % LIMB_BITS)); |
347 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE5ResetEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE5ResetEj |
348 | | /** Retrieve a bit at the given position. */ |
349 | | bool constexpr operator[](unsigned pos) const noexcept |
350 | 0 | { |
351 | 0 | Assume(pos < MAX_SIZE); |
352 | 0 | return (m_val[pos / LIMB_BITS] >> (pos % LIMB_BITS)) & 1U; |
353 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EEixEj Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EEixEj |
354 | | /** Construct a bitset with the singleton pos. */ |
355 | | static constexpr MultiIntBitSet Singleton(unsigned pos) noexcept |
356 | 0 | { |
357 | 0 | Assume(pos < MAX_SIZE); |
358 | 0 | MultiIntBitSet ret; |
359 | 0 | ret.m_val[pos / LIMB_BITS] = I{1U} << (pos % LIMB_BITS); |
360 | 0 | return ret; |
361 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE9SingletonEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE9SingletonEj |
362 | | /** Construct a bitset with bits 0..count-1 (inclusive) set to 1. */ |
363 | | static constexpr MultiIntBitSet Fill(unsigned count) noexcept |
364 | 0 | { |
365 | 0 | Assume(count <= MAX_SIZE); |
366 | 0 | MultiIntBitSet ret; |
367 | 0 | if (count) { Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
Branch (367:13): [True: 0, False: 0]
|
368 | 0 | unsigned i = 0; |
369 | 0 | while (count > LIMB_BITS) { Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
Branch (369:20): [True: 0, False: 0]
|
370 | 0 | ret.m_val[i++] = I(~I{0}); |
371 | 0 | count -= LIMB_BITS; |
372 | 0 | } |
373 | 0 | ret.m_val[i] = I(~I{0}) >> (LIMB_BITS - count); |
374 | 0 | } |
375 | 0 | return ret; |
376 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE4FillEj Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE4FillEj |
377 | | /** Return the number of bits that this object holds. */ |
378 | 0 | static constexpr unsigned Size() noexcept { return MAX_SIZE; }Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EE4SizeEv Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EE4SizeEv |
379 | | /** Compute the number of 1 bits in the bitset. */ |
380 | | unsigned constexpr Count() const noexcept |
381 | 0 | { |
382 | 0 | unsigned ret{0}; |
383 | 0 | for (I v : m_val) ret += PopCount(v); Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
Branch (383:18): [True: 0, False: 0]
|
384 | 0 | return ret; |
385 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE5CountEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE5CountEv |
386 | | /** Check if all bits are 0. */ |
387 | | bool constexpr None() const noexcept |
388 | 0 | { |
389 | 0 | for (auto v : m_val) { Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
Branch (389:21): [True: 0, False: 0]
|
390 | 0 | if (v != 0) return false; Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
Branch (390:17): [True: 0, False: 0]
|
391 | 0 | } |
392 | 0 | return true; |
393 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE4NoneEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE4NoneEv |
394 | | /** Check if any bits are 1. */ |
395 | 0 | bool constexpr Any() const noexcept { return !None(); }Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE3AnyEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE3AnyEv |
396 | | /** Return an object that iterates over all 1 bits (++ and * only allowed when != end()). */ |
397 | 0 | Iterator constexpr begin() const noexcept { return Iterator(m_val); }Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE5beginEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE5beginEv |
398 | | /** Return a dummy object to compare Iterators with. */ |
399 | 0 | IteratorEnd constexpr end() const noexcept { return IteratorEnd(); }Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE3endEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE3endEv |
400 | | /** Find the first element (requires Any()). */ |
401 | | unsigned constexpr First() const noexcept |
402 | 0 | { |
403 | 0 | unsigned p = 0; |
404 | 0 | while (m_val[p] == 0) { Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
Branch (404:16): [True: 0, False: 0]
|
405 | 0 | ++p; |
406 | 0 | Assume(p < N); |
407 | 0 | } |
408 | 0 | return std::countr_zero(m_val[p]) + p * LIMB_BITS; |
409 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE5FirstEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE5FirstEv |
410 | | /** Find the last element (requires Any()). */ |
411 | | unsigned constexpr Last() const noexcept |
412 | 0 | { |
413 | 0 | unsigned p = N - 1; |
414 | 0 | while (m_val[p] == 0) { Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
Branch (414:16): [True: 0, False: 0]
|
415 | 0 | Assume(p > 0); |
416 | 0 | --p; |
417 | 0 | } |
418 | 0 | return std::bit_width(m_val[p]) - 1 + p * LIMB_BITS; |
419 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE4LastEv Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE4LastEv |
420 | | /** Set this object's bits to be the binary OR between respective bits from this and a. */ |
421 | | constexpr MultiIntBitSet& operator|=(const MultiIntBitSet& a) noexcept |
422 | 0 | { |
423 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
Branch (423:30): [True: 0, False: 0]
|
424 | 0 | m_val[i] |= a.m_val[i]; |
425 | 0 | } |
426 | 0 | return *this; |
427 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEoRERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEoRERKS1_ |
428 | | /** Set this object's bits to be the binary AND between respective bits from this and a. */ |
429 | | constexpr MultiIntBitSet& operator&=(const MultiIntBitSet& a) noexcept |
430 | 0 | { |
431 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
Branch (431:30): [True: 0, False: 0]
|
432 | 0 | m_val[i] &= a.m_val[i]; |
433 | 0 | } |
434 | 0 | return *this; |
435 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEaNERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEaNERKS1_ |
436 | | /** Set this object's bits to be the binary AND NOT between respective bits from this and a. */ |
437 | | constexpr MultiIntBitSet& operator-=(const MultiIntBitSet& a) noexcept |
438 | 0 | { |
439 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
Branch (439:30): [True: 0, False: 0]
|
440 | 0 | m_val[i] &= ~a.m_val[i]; |
441 | 0 | } |
442 | 0 | return *this; |
443 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEmIERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEmIERKS1_ |
444 | | /** Set this object's bits to be the binary XOR between respective bits from this and a. */ |
445 | | constexpr MultiIntBitSet& operator^=(const MultiIntBitSet& a) noexcept |
446 | 0 | { |
447 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
Branch (447:30): [True: 0, False: 0]
|
448 | 0 | m_val[i] ^= a.m_val[i]; |
449 | 0 | } |
450 | 0 | return *this; |
451 | 0 | } Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj1EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj2EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj3EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj1EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj2EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetItLj4EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj3EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj2EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetIjLj4EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj3EEeOERKS1_ Unexecuted instantiation: _ZN13bitset_detail14MultiIntBitSetImLj4EEeOERKS1_ |
452 | | /** Check whether the intersection between two sets is non-empty. */ |
453 | | constexpr bool Overlaps(const MultiIntBitSet& a) const noexcept |
454 | 0 | { |
455 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
Branch (455:30): [True: 0, False: 0]
|
456 | 0 | if (m_val[i] & a.m_val[i]) return true; Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
Branch (456:17): [True: 0, False: 0]
|
457 | 0 | } |
458 | 0 | return false; |
459 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE8OverlapsERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE8OverlapsERKS1_ |
460 | | /** Return an object with the binary AND between respective bits from a and b. */ |
461 | | friend constexpr MultiIntBitSet operator&(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept |
462 | 0 | { |
463 | 0 | MultiIntBitSet r; |
464 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
Branch (464:30): [True: 0, False: 0]
|
465 | 0 | r.m_val[i] = a.m_val[i] & b.m_val[i]; |
466 | 0 | } |
467 | 0 | return r; |
468 | 0 | } Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetItLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetItLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetItLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetImLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetIjLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetItLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetIjLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetImLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetIjLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetImLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailanERKNS_14MultiIntBitSetImLj4EEES3_ |
469 | | /** Return an object with the binary OR between respective bits from a and b. */ |
470 | | friend constexpr MultiIntBitSet operator|(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept |
471 | 0 | { |
472 | 0 | MultiIntBitSet r; |
473 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
Branch (473:30): [True: 0, False: 0]
|
474 | 0 | r.m_val[i] = a.m_val[i] | b.m_val[i]; |
475 | 0 | } |
476 | 0 | return r; |
477 | 0 | } Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetItLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetItLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetItLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetImLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetIjLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetItLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetIjLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetImLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetIjLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetImLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailorERKNS_14MultiIntBitSetImLj4EEES3_ |
478 | | /** Return an object with the binary AND NOT between respective bits from a and b. */ |
479 | | friend constexpr MultiIntBitSet operator-(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept |
480 | 0 | { |
481 | 0 | MultiIntBitSet r; |
482 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
Branch (482:30): [True: 0, False: 0]
|
483 | 0 | r.m_val[i] = a.m_val[i] & ~b.m_val[i]; |
484 | 0 | } |
485 | 0 | return r; |
486 | 0 | } Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetItLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetItLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetItLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetImLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetIjLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetItLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetIjLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetImLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetIjLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetImLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detailmiERKNS_14MultiIntBitSetImLj4EEES3_ |
487 | | /** Return an object with the binary XOR between respective bits from a and b. */ |
488 | | friend constexpr MultiIntBitSet operator^(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept |
489 | 0 | { |
490 | 0 | MultiIntBitSet r; |
491 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
Branch (491:30): [True: 0, False: 0]
|
492 | 0 | r.m_val[i] = a.m_val[i] ^ b.m_val[i]; |
493 | 0 | } |
494 | 0 | return r; |
495 | 0 | } Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetItLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetItLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetItLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetImLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetIjLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetItLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetIjLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetImLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetIjLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetImLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileoERKNS_14MultiIntBitSetImLj4EEES3_ |
496 | | /** Check if bitset a is a superset of bitset b (= every 1 bit in b is also in a). */ |
497 | | constexpr bool IsSupersetOf(const MultiIntBitSet& a) const noexcept |
498 | 0 | { |
499 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
Branch (499:30): [True: 0, False: 0]
|
500 | 0 | if (a.m_val[i] & ~m_val[i]) return false; Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
Branch (500:17): [True: 0, False: 0]
|
501 | 0 | } |
502 | 0 | return true; |
503 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE12IsSupersetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE12IsSupersetOfERKS1_ |
504 | | /** Check if bitset a is a subset of bitset b (= every 1 bit in a is also in b). */ |
505 | | constexpr bool IsSubsetOf(const MultiIntBitSet& a) const noexcept |
506 | 0 | { |
507 | 0 | for (unsigned i = 0; i < N; ++i) { Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
Branch (507:30): [True: 0, False: 0]
|
508 | 0 | if (m_val[i] & ~a.m_val[i]) return false; Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
Branch (508:17): [True: 0, False: 0]
|
509 | 0 | } |
510 | 0 | return true; |
511 | 0 | } Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj1EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj2EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj3EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj1EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj2EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetItLj4EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj3EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj2EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetIjLj4EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj3EE10IsSubsetOfERKS1_ Unexecuted instantiation: _ZNK13bitset_detail14MultiIntBitSetImLj4EE10IsSubsetOfERKS1_ |
512 | | /** Check if bitset a and bitset b are identical. */ |
513 | 0 | friend constexpr bool operator==(const MultiIntBitSet& a, const MultiIntBitSet& b) noexcept = default; Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj1EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetItLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj2EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetIjLj4EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj3EEES3_ Unexecuted instantiation: _ZN13bitset_detaileqERKNS_14MultiIntBitSetImLj4EEES3_ |
514 | | /** Swap two bitsets. */ |
515 | 0 | friend constexpr void swap(MultiIntBitSet& a, MultiIntBitSet& b) noexcept { std::swap(a.m_val, b.m_val); }Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetItLj1EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetItLj2EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetItLj3EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetImLj1EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetIjLj2EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetItLj4EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetIjLj3EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetImLj2EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetIjLj4EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetImLj3EEES2_ Unexecuted instantiation: _ZN13bitset_detail4swapERNS_14MultiIntBitSetImLj4EEES2_ |
516 | | }; |
517 | | |
518 | | } // namespace bitset_detail |
519 | | |
520 | | // BitSet dispatches to IntBitSet or MultiIntBitSet as appropriate for the requested minimum number |
521 | | // of bits. Use IntBitSet up to 32-bit, or up to 64-bit on 64-bit platforms; above that, use a |
522 | | // MultiIntBitSet of size_t. |
523 | | template<unsigned BITS> |
524 | | using BitSet = std::conditional_t<(BITS <= 32), bitset_detail::IntBitSet<uint32_t>, |
525 | | std::conditional_t<(BITS <= std::numeric_limits<size_t>::digits), bitset_detail::IntBitSet<size_t>, |
526 | | bitset_detail::MultiIntBitSet<size_t, CeilDiv(BITS, size_t{std::numeric_limits<size_t>::digits})>>>; |
527 | | |
528 | | #endif // BITCOIN_UTIL_BITSET_H |