![]() |
Gray C++ Libraries
0.0.2
A set of C++ libraries for MSVC, GNU on Windows, WinCE, Linux
|
#include <cBits.h>
Static Public Member Functions | |
static constexpr size_t | GetSizeBytes (BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static constexpr TYPE | Mask1 (BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | IsMask1 (TYPE nVal) noexcept |
template<typename TYPE > | |
static constexpr bool | IsSet (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | IsClear (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr TYPE | SetBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr TYPE | ClearBit (TYPE nVal, BIT_ENUM_t nBit) noexcept |
template<typename TYPE > | |
static constexpr bool | HasMask (TYPE nVal, TYPE nMask) noexcept |
template<typename TYPE > | |
static BIT_ENUM_t | Highest1Bit (TYPE nMask) noexcept |
template<typename TYPE > | |
static BIT_ENUM_t | Count1Bits (TYPE nMask) noexcept |
template<typename TYPE > | |
static TYPE | Rotl (TYPE nVal, BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static TYPE | Rotr (TYPE nVal, BIT_ENUM_t nBits) noexcept |
template<typename TYPE > | |
static TYPE | Reverse (TYPE nVal) noexcept |
template<> | |
BIT_ENUM_t | Count1Bits (UINT32 nVal) noexcept |
template<> | |
BYTE | Reverse (BYTE nVal) noexcept |
template<> | |
UINT32 | Reverse (UINT32 nVal) noexcept |
template<> | |
ULONG | Reverse (ULONG nVal) noexcept |
Static Public Attributes | |
static const BYTE | k_8 = 8 |
represent the 8 bits in a byte. BIT_ENUM_t More... | |
Friends | |
class | cBitsTests |
Bit mask type operations of all sorts. on various integral data types.
|
inlinestaticconstexprnoexcept |
|
inlinestaticnoexcept |
Count total number of 1 bits. like: __builtin_popcount()
|
inlinestaticnoexcept |
A math trick for counting 1 bits in 32 bit numbers.
|
inlinestaticconstexprnoexcept |
How many bytes to hold these bits. Round up to next byte.
|
inlinestaticconstexprnoexcept |
Any nMask bits set ?
|
inlinestaticnoexcept |
What is the highest set bit in this primitive TYPE. 1 based. MSB.
|
inlinestaticconstexprnoexcept |
Test if a bit is NOT set.
|
inlinestaticconstexprnoexcept |
Does this just have a single bit on ? Is power of 2 ?
|
inlinestaticconstexprnoexcept |
Test if a bit is set.
|
inlinestaticconstexprnoexcept |
Create a 1 bit mask of a given TYPE. Overflow/Underflow is just lost. _1BITMASK(nBit) = cBits::Mask1<size_t>(nBit). default TYPE = size_t
|
inlinestaticnoexcept |
Reverse the order of the 8 bits. using 32 or 64 bit temporary. http://graphics.stanford.edu/~seander/bithacks.html#ReverseByteWith32Bits
Reverse the order of the bits. ASSUME not signed?
|
inlinestaticnoexcept |
Reverse the order of the 32 bits.
|
inlinestaticnoexcept |
ULONG may be equiv to UINT32 or UINT64
|
inlinestaticnoexcept |
Rotate bits left. If system doesn't have an inline rotate left function for X bits.
|
inlinestaticnoexcept |
Rotate bits right.
|
inlinestaticconstexprnoexcept |
|
friend |
|
static |
represent the 8 bits in a byte. BIT_ENUM_t