MDSTk Libraries
1.1.0
Medical Data Segmentation Toolkit
|
Various routines for manipulating bits in integers. More...
#include <mdsBitOps.h>
Public Types | |
enum | { VALID_BITS = N } |
User defined number of used rightmost bits. More... | |
enum | { NUM_OF_BITS = sizeof(T) * 8 } |
Size of the T type in bits. More... | |
enum | { UNUSED_BITS = NUM_OF_BITS - N } |
The number of unused bits. More... | |
enum | { isValid = mds::CTypeTraits<T>::isIntegral } |
Test if a given type is valid. More... | |
Public Member Functions | |
template<> | |
unsigned char | getMask () |
template<> | |
unsigned int | getNumOfBits () |
template<> | |
unsigned int | getNumOfOnes (unsigned char Value) |
template<> | |
unsigned int | getNumOfTransitions (unsigned char Value) |
template<> | |
unsigned int | getNumOfValidBits () |
template<> | |
unsigned char | rotate2Min (unsigned char Value) |
template<> | |
unsigned char | rotateLeft (unsigned char Value, unsigned int n) |
template<> | |
unsigned char | rotateRight (unsigned char Value, unsigned int n) |
Static Public Member Functions | |
static std::string | conv2String (T Value) |
Returns a textual representation of a binary number. | |
static T | getMask () |
Returns mask of valid rightmost bits. | |
static unsigned int | getNumOfBits () |
Returns number of bits in template type (considering 8-bit per byte). | |
static unsigned int | getNumOfOnes (T Value) |
Returns the number of ones in a binary number. | |
static unsigned int | getNumOfTransitions (T Value) |
Returns the number of 0-to-1 or 1-to-0 transitions in a binary number. | |
static unsigned int | getNumOfValidBits () |
Returns the user defined number of valid rightmost bits. | |
static T | rotate2Min (T Value) |
Rotates a binary number to the minimum possible value. | |
static T | rotateLeft (T Value, unsigned int n) |
Rotates a binary number left by n positions. | |
static T | rotateRight (T Value, unsigned int n) |
Rotates a binary number right by n positions. |
Various routines for manipulating bits in integers.
anonymous enum |
anonymous enum |
anonymous enum |
anonymous enum |
static std::string mds::lbp::CBitOps< T, N >::conv2String | ( | T | Value | ) | [static] |
Returns a textual representation of a binary number.
static T mds::lbp::CBitOps< T, N >::getMask | ( | ) | [static] |
Returns mask of valid rightmost bits.
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::getMask | ( | ) |
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfBits | ( | ) | [static] |
Returns number of bits in template type (considering 8-bit per byte).
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfBits | ( | ) |
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfOnes | ( | T | Value | ) | [static] |
Returns the number of ones in a binary number.
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfOnes | ( | unsigned char | Value | ) |
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfTransitions | ( | T | Value | ) | [static] |
Returns the number of 0-to-1 or 1-to-0 transitions in a binary number.
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfTransitions | ( | unsigned char | Value | ) |
static unsigned int mds::lbp::CBitOps< T, N >::getNumOfValidBits | ( | ) | [static] |
Returns the user defined number of valid rightmost bits.
unsigned int mds::lbp::CBitOps< unsigned char, 8 >::getNumOfValidBits | ( | ) |
static T mds::lbp::CBitOps< T, N >::rotate2Min | ( | T | Value | ) | [static] |
Rotates a binary number to the minimum possible value.
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotate2Min | ( | unsigned char | Value | ) |
static T mds::lbp::CBitOps< T, N >::rotateLeft | ( | T | Value, |
unsigned int | n | ||
) | [static] |
Rotates a binary number left by n positions.
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotateLeft | ( | unsigned char | Value, |
unsigned int | n | ||
) |
static T mds::lbp::CBitOps< T, N >::rotateRight | ( | T | Value, |
unsigned int | n | ||
) | [static] |
Rotates a binary number right by n positions.
unsigned char mds::lbp::CBitOps< unsigned char, 8 >::rotateRight | ( | unsigned char | Value, |
unsigned int | n | ||
) |