|
| cbitsetN () |
|
size_t | capacity () const |
| Return maximum number of bits this bitset can hold. More...
|
|
void | clear () |
| Sets all bits to 0. More...
|
|
bool | empty () const |
| Returns true if all bits are unset. More...
|
|
size_t | numBitsSet (const size_t positionEnd) const |
| Returns the number of bits that are set between range [0; positionEnd). More...
|
|
void | set (const size_t position) |
| Sets bit at 'position' to 1. More...
|
|
void | setAll () |
| Sets all bits to 1. More...
|
|
void | setAllUntil (size_t position) |
| Sets all bits in range [0; position) It's the same as calling: More...
|
|
void | setValue (const size_t position, const bool bValue) |
| Sets bit at 'position'. More...
|
|
bool | test (const size_t position) const |
| Returns true if bit at 'position' is 1. More...
|
|
void | unset (const size_t position) |
| Sets bit at 'position' to 0. More...
|
|
template<size_t _N, typename _internalDataType, size_t _bits, size_t _mask>
class Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >
- Parameters
-
_N | Number of bits this bitset will hold |
_bits | The exponent of the number of bits to hold per mValues. E.g. 32 bits per mValues needs _bits = 5, because 2^5 = 32 Note we never tested other combinations where 2^_bits * 8 != sizeof( _internalDataType ) |
_mask | The maximum number of bits - 1 to avoid overflow e.g. 32 bits per mValues needs a mask of 31 (0x1F) to wrap around so when we call
void set(const size_t position) Sets bit at 'position' to 1.
|
It actually performs:
idx = 32 / 32;
mask = 32 % 32;
this->mValues[idx] |= mask;
template<size_t _N, typename _internalDataType , size_t _bits, size_t _mask>
void Ogre::cbitsetN< _N, _internalDataType, _bits, _mask >::setAllUntil |
( |
size_t |
position | ) |
|
Sets all bits in range [0; position) It's the same as calling:
for( size_t i = 0u; i < position; ++i ) this->set( i );
Values in range [position; _N) are left untouched
- Parameters
-