linear.h
Go to the documentation of this file.
/**
* @file linear.h
* @brief Linear memory allocator.
*/
#pragma once
#include <stddef.h>
/**
* @brief Allocates a 0x80-byte aligned buffer.
* @param size Size of the buffer to allocate.
* @return The allocated buffer.
*/
void* linearAlloc(size_t size);
/**
* @brief Allocates a buffer aligned to the given size.
* @param size Size of the buffer to allocate.
* @param alignment Alignment to use.
* @return The allocated buffer.
*/
void* linearMemAlign(size_t size, size_t alignment);
/**
* @brief Reallocates a buffer.
* Note: Not implemented yet.
* @param mem Buffer to reallocate.
* @param size Size of the buffer to allocate.
* @return The reallocated buffer.
*/
void* linearRealloc(void* mem, size_t size);
/**
* @brief Retrieves the allocated size of a buffer.
* @return The size of the buffer.
*/
size_t linearGetSize(void* mem);
/**
* @brief Frees a buffer.
* @param mem Buffer to free.
*/
void linearFree(void* mem);
/**
* @brief Gets the current linear free space.
* @return The current linear free space.
*/
u32 linearSpaceFree(void);
linearGetSize
size_t linearGetSize(void *mem)
Retrieves the allocated size of a buffer.
linearRealloc
void * linearRealloc(void *mem, size_t size)
Reallocates a buffer.
linearAlloc
void * linearAlloc(size_t size)
Allocates a 0x80-byte aligned buffer.
linearMemAlign
void * linearMemAlign(size_t size, size_t alignment)
Allocates a buffer aligned to the given size.
linearSpaceFree
u32 linearSpaceFree(void)
Gets the current linear free space.
linearFree
void linearFree(void *mem)
Frees a buffer.
u32
uint32_t u32
32-bit unsigned integer
Definition: types.h:23