1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-01 13:24:20 +01:00
rpi-vk-driver/driver/PoolAllocator.h

27 lines
527 B
C
Raw Normal View History

2018-05-10 23:10:35 +02:00
#pragma once
2018-05-13 16:29:15 +02:00
#if defined (__cplusplus)
extern "C" {
#endif
2018-05-10 23:10:35 +02:00
#include "CustomAssert.h"
#include <stdint.h>
typedef struct PoolAllocator
{
char* buf; //preallocated buffer
2018-05-20 16:16:50 +02:00
uint32_t* nextFreeBlock;
2018-05-10 23:10:35 +02:00
unsigned blockSize;
unsigned size; //size is exact multiple of block size
} PoolAllocator;
2018-08-26 15:11:43 +02:00
PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s);
void destroyPoolAllocator(PoolAllocator* pa);
void* poolAllocate(PoolAllocator* pa);
void poolFree(PoolAllocator* pa, void* p);
2018-05-13 16:29:15 +02:00
#if defined (__cplusplus)
}
#endif