Contains implementation details for BitManipulator where we optimise according to the size of the underlying data type.
More...
#include <utilities/bitmanip.h>
|
static int | bits (T x) |
| Returns the number of bits that are set to 1 in the given integer. More...
|
|
template<typename T, unsigned size = sizeof(T)>
class regina::BitManipulatorBySize< T, size >
Contains implementation details for BitManipulator where we optimise according to the size of the underlying data type.
End users should use the BitManipulator class, not this class.
- Precondition
- Type T is an unsigned integral numeric type.
-
The argument size is a power of two, and is at most sizeof(T).
- Python
- Only the end-user class BitManipulator<unsigned long> is available to Python users.
- Template Parameters
-
T | an unsigned integral numeric type, which we treat as a sequence of true and/or false bits. |
size | the number of bytes of T to examine. Any higher-order bits will be ignored by the implementations in this class. |
◆ bits()
template<typename T , unsigned size = sizeof(T)>
Returns the number of bits that are set to 1 in the given integer.
- Parameters
-
x | the integer of type T to examine. |
- Returns
- the number of bits that are set.
◆ specialised
template<typename T , unsigned size = sizeof(T)>
Indicates whether this class is a template specialisation of BitManipulatorBySize with extra optimisations.
This compile-time constant is set to false
for the generic implementation of BitManipulatorBySize, and true
for all specialisations.
The documentation for this class was generated from the following file: