An optimised class for bitwise analysis and manipulation of native data types. More...
#include <bitmanip.h>
Public Types | |
enum | { specialised = 0 } |
Static Public Member Functions | |
static int | bits (T x) |
Returns the number of bits that are set in the given integer. |
An optimised class for bitwise analysis and manipulation of native data types.
The class BitManipulator<T, size> is used to manipulate the lowest size bytes of type T, which must be an unsigned native integer type such as unsigned char, unsigned int, or unsigned long long.
The generic implementation of BitManipulator is here for completeness. All or most native types T have template specialisations that are carefully optimised (precisely what gets specialised depends upon properties of the compiler).
anonymous enum |
specialised |
Indicates whether this class is a template specialisation of BitManipulator with extra optimisations. This compile-time constant is set to 0 for the generic implementation of BitManipulator, and 1 for all specialisations. |
static int regina::BitManipulator< T, size >::bits | ( | T | x | ) | [inline, static] |
Returns the number of bits that are set in the given integer.
Specifically, this routine returns the number of bits set to 1 from amongst the lowest size bytes of x.
x | the integer of type T to examine. |