libctru v2.5.0
Loading...
Searching...
No Matches
linear.h
Go to the documentation of this file.
1/**
2 * @file linear.h
3 * @brief Linear memory allocator.
4 */
5#pragma once
6
7#include <stddef.h>
8
9/**
10 * @brief Allocates a 0x80-byte aligned buffer.
11 * @param size Size of the buffer to allocate.
12 * @return The allocated buffer.
13 */
14void* linearAlloc(size_t size);
15
16/**
17 * @brief Allocates a buffer aligned to the given size.
18 * @param size Size of the buffer to allocate.
19 * @param alignment Alignment to use.
20 * @return The allocated buffer.
21 */
22void* linearMemAlign(size_t size, size_t alignment);
23
24/**
25 * @brief Reallocates a buffer.
26 * Note: Not implemented yet.
27 * @param mem Buffer to reallocate.
28 * @param size Size of the buffer to allocate.
29 * @return The reallocated buffer.
30 */
31void* linearRealloc(void* mem, size_t size);
32
33/**
34 * @brief Retrieves the allocated size of a buffer.
35 * @return The size of the buffer.
36 */
37size_t linearGetSize(void* mem);
38
39/**
40 * @brief Frees a buffer.
41 * @param mem Buffer to free.
42 */
43void linearFree(void* mem);
44
45/**
46 * @brief Gets the current linear free space.
47 * @return The current linear free space.
48 */
void * linearRealloc(void *mem, size_t size)
Reallocates a buffer.
void * linearAlloc(size_t size)
Allocates a 0x80-byte aligned buffer.
size_t linearGetSize(void *mem)
Retrieves the allocated size of a buffer.
void * linearMemAlign(size_t size, size_t alignment)
Allocates a buffer aligned to the given size.
u32 linearSpaceFree(void)
Gets the current linear free space.
void linearFree(void *mem)
Frees a buffer.
uint32_t u32
32-bit unsigned integer
Definition types.h:23