Go to the documentation of this file.
59 bool current =
m_array[bit / 8] & (1 << (bit % 8));
66 m_array[bit / 8] |= 1 << (bit % 8);
71 m_array[bit / 8] &= ~(1 << (bit % 8));
86 return m_array[bit / 8] & (1 << (bit % 8));
91 for (
Size i = from; i <= to; i++)
102 Size from = 0, found = 0;
113 i += (32 - (i % 32));
220 const Size bytes = bitCount / 8;
void set(const Size bit, const bool value=true)
Sets the given bit to the given value.
bool isSet(const Size bit) const
Verify if a given bit is set.
static void * set(void *dest, int ch, unsigned count)
Fill memory with a constant byte.
void setRange(const Size from, const Size to)
Set a range of bits inside the map to 1.
u8 * m_array
Array containing the bits.
u8 * array() const
Retrieve a pointer to the internal BitArray.
BitArray(const Size bitCount, u8 *array=ZERO)
Class constructor.
virtual ~BitArray()
Class destructor.
Size m_set
Set bits in the array.
unsigned int u32
Unsigned 32-bit number.
Result setNext(Size *bit, const Size count=1, const Size offset=0, const Size boundary=1)
Sets the next unset bit(s).
void unset(const Size bit)
Sets the given bit to zero.
unsigned int Size
Any sane size indicator cannot go negative.
Size m_bitCount
Total number of bits in the array.
Size count(const bool on) const
Get the number of bits in the map which have the given value.
Size calculateBitmapSize(const Size bitCount) const
Calculate required size of bitmap array in bytes.
bool m_allocated
True if m_array was allocated interally.
#define assert(exp)
Insert program diagnostics.
unsigned char u8
Unsigned 8-bit number.
void setArray(u8 *array, const Size bitCount=ZERO)
Use the given pointer as the BitArray buffer.
void clear()
Set all bits to zero.
Size size() const
Returns the maximum size of this Container.
bool operator[](const Size bit) const
Retrieve the value of the given bit.