gwnavruntime/containers/bitfieldfixedsize.h Source File
Go to the documentation of this file.
17 class BitFieldFixedSize
20 BitFieldFixedSize() { UnsetAllBits(); }
22 void SetBit(
KyUInt32 index) { GetByteByGlobalIndex(index) |= (
KyUInt8) 1 << GetPosInElem(index); }
23 void UnsetBit(
KyUInt32 index) { GetByteByGlobalIndex(index) &= (
KyUInt8) ~(1 << GetPosInElem(index)); }
25 void UnsetAllBits() { memset(m_bytes,
'\0',
sizeof (m_bytes)); }
26 void SetAllBits() { memset(m_bytes,
'\xFF',
sizeof (m_bytes)); }
28 bool IsBitSet(
KyUInt32 index)
const {
return ((GetByteByGlobalIndex(index) >> GetPosInElem(index)) & 0x01) != 0; }
30 const KyUInt8& GetByteByGlobalIndex(
KyUInt32 index)
const {
return m_bytes[index / nbBitPerByte]; }
31 KyUInt8& GetByteByGlobalIndex(
KyUInt32 index) {
return m_bytes[index / nbBitPerByte]; }
34 enum { mask = 0x07, nbBitPerByte = 8};
35 enum { nbBytes = (N + 7) / 8 };
std::uint32_t KyUInt32
uint32_t
Definition: types.h:29
The Autodesk Navigation namespace.
Definition: gamekitcrowddispersion.cpp:17
std::uint8_t KyUInt8
uint8_t
Definition: types.h:27