49 lines
1.1 KiB
C
49 lines
1.1 KiB
C
/**
|
|
* @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);
|