2023-10-17 11:25:02 +00:00
|
|
|
|
|
|
|
#ifndef TC_CHUNK_POOL_H
|
|
|
|
#define TC_CHUNK_POOL_H
|
|
|
|
|
|
|
|
#include <utility/utility.h>
|
2023-10-17 14:37:19 +00:00
|
|
|
#include <world/chunk.h>
|
2023-10-17 11:25:02 +00:00
|
|
|
|
|
|
|
typedef struct tc_chunk_pool tc_chunk_pool_s;
|
|
|
|
typedef struct tc_chunk_pool_entry tc_chunk_pool_entry_s;
|
|
|
|
|
|
|
|
struct tc_chunk_pool_entry
|
|
|
|
{
|
|
|
|
tc_chunk_pool_entry_s *next;
|
|
|
|
tc_chunk_pool_entry_s *previous;
|
|
|
|
|
|
|
|
tc_chunk_s chunk;
|
|
|
|
};
|
|
|
|
|
|
|
|
struct tc_chunk_pool
|
|
|
|
{
|
|
|
|
u32_t capacity;
|
|
|
|
u32_t used_entries;
|
|
|
|
tc_chunk_pool_entry_s *entries;
|
|
|
|
tc_chunk_pool_entry_s *first_free;
|
|
|
|
|
|
|
|
tc_chunk_pool_s *continuation;
|
|
|
|
};
|
|
|
|
|
|
|
|
void tc_cleanup_chunk_pool ();
|
|
|
|
void tc_init_chunk_pool (u32_t capacity);
|
|
|
|
tc_chunk_s * tc_allocate_chunk ();
|
|
|
|
void tc_deallocate_chunk (tc_chunk_s *chunk);
|
|
|
|
|
|
|
|
#endif // TC_CHUNK_POOL_H
|
|
|
|
|