Go to the documentation of this file.
25 , m_array(range.size / chunkSize, bitmap)
26 , m_chunkSize(chunkSize)
void set(const Size bit, const bool value=true)
Sets the given bit to the given value.
Result allocateFrom(Range &args, const Size startBit)
Allocate memory from defined starting address.
bool isSet(const Size bit) const
Verify if a given bit is set.
Size chunkSize() const
Get chunk size.
bool isAllocated(const Address page) const
Check if a chunk is allocated.
Result allocateAt(const Address addr)
Allocate a specific address.
unsigned long Address
A memory address.
Address address
Starting address of the memory range.
Size alignment
Alignment in bytes or ZERO for default alignment.
virtual Size available() const
Get available memory.
Size size
Amount of memory in bytes.
BitArray m_array
Marks which chunks are (un)used.
virtual Result release(const Address chunk)
Release memory chunk.
Size m_lastBit
Last bit that was set.
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.
virtual Size size() const
Get memory size.
Size count(const bool on) const
Get the number of bits in the map which have the given value.
Address base() const
Get memory base address for allocations.
Size alignment() const
Get memory alignment in bytes for allocations.
Describes a range of memory.
BitAllocator(const Range range, const Size chunkSize, u8 *bitmap=ZERO)
Constructor function.
#define assert(exp)
Insert program diagnostics.
unsigned char u8
Unsigned 8-bit number.
virtual Result allocate(Range &args)
Allocate memory.
const Size m_chunkSize
Size of each chunk.
Result
Allocation results.