#include "lbm_types.h"
#include <stdint.h>
#include <stddef.h>
Go to the source code of this file.
◆ LBM_MEMORY_BITMAP_SIZE
#define LBM_MEMORY_BITMAP_SIZE |
( |
|
X | ) |
(X) |
◆ LBM_MEMORY_BITMAP_SIZE_10K
◆ LBM_MEMORY_BITMAP_SIZE_12K
◆ LBM_MEMORY_BITMAP_SIZE_14K
◆ LBM_MEMORY_BITMAP_SIZE_16K
◆ LBM_MEMORY_BITMAP_SIZE_1K
◆ LBM_MEMORY_BITMAP_SIZE_1M
◆ LBM_MEMORY_BITMAP_SIZE_2K
◆ LBM_MEMORY_BITMAP_SIZE_32K
◆ LBM_MEMORY_BITMAP_SIZE_4K
◆ LBM_MEMORY_BITMAP_SIZE_512
◆ LBM_MEMORY_BITMAP_SIZE_8K
◆ LBM_MEMORY_SIZE_10K
◆ LBM_MEMORY_SIZE_12K
◆ LBM_MEMORY_SIZE_14K
◆ LBM_MEMORY_SIZE_16K
◆ LBM_MEMORY_SIZE_1K
◆ LBM_MEMORY_SIZE_1M
◆ LBM_MEMORY_SIZE_2K
◆ LBM_MEMORY_SIZE_32K
◆ LBM_MEMORY_SIZE_4K
◆ LBM_MEMORY_SIZE_512
◆ LBM_MEMORY_SIZE_64BYTES_TIMES_X
#define LBM_MEMORY_SIZE_64BYTES_TIMES_X |
( |
|
X | ) |
(16*(X)) |
◆ LBM_MEMORY_SIZE_8K
◆ lbm_free()
void lbm_free |
( |
void * |
ptr | ) |
|
Free memory allocated with lbm_malloc
- Parameters
-
◆ lbm_malloc()
void* lbm_malloc |
( |
size_t |
size | ) |
|
Malloc like interface to lbm_memory
- Parameters
-
size | Size in bytes of memory to allocate. |
- Returns
- Pointer to array or NULL.
◆ lbm_malloc_reserve()
void* lbm_malloc_reserve |
( |
size_t |
size | ) |
|
Allocate memory potentially from the reserved memory.
- Parameters
-
size | Size in bytes of memory to allocate. |
- Returns
- Pointer to array or NULL.
◆ lbm_memory_address_to_ix()
◆ lbm_memory_allocate()
Allocate a number of words from the symbols and arrays memory.
- Parameters
-
num_words | Number of words to allocate. |
- Returns
- pointer to allocated array or NULL.
◆ lbm_memory_free()
Free an allocated array int the symbols and arrays memory.
- Parameters
-
ptr | Pointer to array to free. |
- Returns
- 1 on success and 0 on failure.
◆ lbm_memory_get_reserve()
lbm_uint lbm_memory_get_reserve |
( |
void |
| ) |
|
Get the number of words of memory that is treated as reserve.
- Returns
- Number of words that are reserved
◆ lbm_memory_init()
Initialize the symbols and arrays memory
- Parameters
-
data | Pointer to an array of uint32_t for data storage. |
data_size | The size of the data storage array in number of uint32_t elements. |
bitmap | Pointer to an array of uint32_t for memory allocator meta-data. |
bitmap_size | The size of the meta-data in number of uint32_t elements. |
- Returns
◆ lbm_memory_longest_free()
lbm_uint lbm_memory_longest_free |
( |
void |
| ) |
|
Find the length of the longest run of consecutire free indices in the LBM memory.
◆ lbm_memory_num_free()
- Returns
- The number of free words in the symbols and arrays memory.
◆ lbm_memory_num_words()
Size of of the symbols and arrays memory in uint32_t chunks.
- Returns
- Number of uint32_t words.
◆ lbm_memory_ptr_inside()
int lbm_memory_ptr_inside |
( |
lbm_uint * |
ptr | ) |
|
Check if a pointer points into the lbm_memory
- Parameters
-
- Returns
- 1 for yes and 0 for no.
◆ lbm_memory_set_reserve()
void lbm_memory_set_reserve |
( |
lbm_uint |
num_words | ) |
|
Set the size of the memory reserve in words.
- Parameters
-
num_words | Number of words to treat as reserve. |
◆ lbm_memory_shrink()
Shrink an allocated array.
- Parameters
-
ptr | Pointer to array to shrink |
n | New smaller size of array |
- Returns
- 1 on success and 0 on failure.