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