A small but extremely fast "ternary bitmask" class that can store up to 8 * sizeof(T) + 8 * sizeof(U) "trits", each equal to 0, 1 or 2.
More...
|
| NTritmask2 () |
| Creates a new tritmask with all trits set to 0. More...
|
|
| NTritmask2 (const NTritmask2< T, U > &cloneMe) |
| Creates a clone of the given tritmask. More...
|
|
void | reset () |
| Sets all trits of this tritmask to 0. More...
|
|
NTritmask2< T, U > & | operator= (const NTritmask2< T, U > &other) |
| Sets this tritmask to a copy of the given tritmask. More...
|
|
char | get (unsigned index) const |
| Returns the value of the given trit in this tritmask. More...
|
|
void | set (unsigned index, char value) |
| Sets the given trit of this tritmask to the given value. More...
|
|
bool | empty () const |
| Determines whether this tritmask contains all zeroes. More...
|
|
bool | nonEmpty () const |
| Determines whether this tritmask contains at least one non-zero trit. More...
|
|
bool | has2 () const |
| Determines whether this tritmask contains at least one trit with value 2. More...
|
|
NTritmask2< T, U > & | minWith (const NTritmask2< T, U > &rhs) |
| Sets this to the minimum of this and the given tritmask. More...
|
|
NTritmask2< T, U > & | maxWith (const NTritmask2< T, U > &rhs) |
| Sets this to the maximum of this and the given tritmask. More...
|
|
NTritmask2< T, U > & | operator+= (const NTritmask2< T, U > &rhs) |
| Sets this to the sum of this and the given tritmask. More...
|
|
NTritmask2< T, U > & | operator-= (const NTritmask2< T, U > &rhs) |
| Sets this to the difference of this and the given tritmask. More...
|
|
bool | operator== (const NTritmask2< T, U > &other) const |
| Determines whether this and the given tritmask are identical. More...
|
|
template<typename T, typename U = T>
class regina::NTritmask2< T, U >
A small but extremely fast "ternary bitmask" class that can store up to 8 * sizeof(T) + 8 * sizeof(U) "trits", each equal to 0, 1 or 2.
This tritmask packs all of the trits together into two variables of type T and two variables of type U. This means that operations on entire tritmasks are extremely fast, because all of the trits can be processed in just a few native CPU operations.
The downside of course is that the number of trits that can be stored is limited to 8 * sizeof(T) + 8 * sizeof(U), where T and U must be native unsigned integer types (such as unsigned char, unsigned int, or unsigned long long).
For an even faster tritmask class that can only store half as many trits, see NTritmask1. At present there is no tritmask class in Regina that can store arbitrarily many trits.
- Precondition
- Types T and U are unsigned integral numeric types.
- Python:
- Not present.