A small but extremely fast "base 4 bitmask" class that can store up to 8 * sizeof(T) "qits", each equal to 0, 1, 2 or 3.
More...
|
| Qitmask1 () |
| Creates a new qitmask with all qits set to 0. More...
|
|
| Qitmask1 (const Qitmask1< T > &cloneMe)=default |
| Creates a clone of the given qitmask. More...
|
|
void | reset () |
| Sets all qits of this qitmask to 0. More...
|
|
Qitmask1< T > & | operator= (const Qitmask1< T > &other)=default |
| Sets this qitmask to a copy of the given qitmask. More...
|
|
uint8_t | get (size_t index) const |
| Returns the value of the given qit in this qitmask. More...
|
|
void | set (size_t index, uint8_t value) |
| Sets the given qit of this qitmask to the given value. More...
|
|
bool | empty () const |
| Determines whether this qitmask contains all zeroes. More...
|
|
bool | nonEmpty () const |
| Determines whether this qitmask contains at least one non-zero qit. More...
|
|
bool | has3 () const |
| Determines whether this qitmask contains at least one qit with value 3. More...
|
|
Qitmask1< T > & | operator+= (const Qitmask1< T > &rhs) |
| Sets this to the sum of this and the given qitmask. More...
|
|
Qitmask1< T > & | operator-= (const Qitmask1< T > &rhs) |
| Sets this to the difference of this and the given qitmask. More...
|
|
bool | operator== (const Qitmask1< T > &other) const |
| Determines whether this and the given qitmask are identical. More...
|
|
bool | operator!= (const Qitmask1< T > &other) const |
| Determines whether this and the given qitmask are different. More...
|
|
bool | hasNonZeroMatch (const Qitmask1< T > &other) const |
| Determines whether there is some index at which both this and the given qitmask both have non-zero qits. More...
|
|
template<typename T>
class regina::Qitmask1< T >
A small but extremely fast "base 4 bitmask" class that can store up to 8 * sizeof(T) "qits", each equal to 0, 1, 2 or 3.
This qitmask packs all of the qits together into two variables of type T. This means that operations on qitmasks are extremely fast, because all of the qits can be processed in just a few native CPU operations.
The downside of course is that the number of qits that can be stored is limited to 8 * sizeof(T), where T must be a native unsigned integer type (such as unsigned char, unsigned int, or unsigned long long).
For another extremely fast qitmask class that can store twice as many qits, see Qitmask2. At present there is no qitmask class in Regina that can store arbitrarily many qits.
These objects are small enough to pass by value and swap with std::swap(), with no need for any specialised move operations or swap functions.
- Precondition
- Type T is an unsigned integral numeric type.
- Python
- Python does not support templates, and so instead Regina's python interface offers the classes Qitmask8, Qitmask16, Qitmask32, Qitmask64, Qitmask128, and (if the machine supports 128-bit integers) Qitmask256. Each of these will be an optimised qitmask class that can hold the corresponding number of bits, and is guaranteed to be an instance of either the C++ Qitmask1<T> class (where possible) or the C++ Qitmask2<T,U> template class (if necessary).