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
2018-08-26 14:11:43 +01:00

27 lines
527 B
C

#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
#include "CustomAssert.h"
#include <stdint.h>
typedef struct PoolAllocator
{
char* buf; //preallocated buffer
uint32_t* nextFreeBlock;
unsigned blockSize;
unsigned size; //size is exact multiple of block size
} PoolAllocator;
PoolAllocator createPoolAllocator(char* b, unsigned bs, unsigned s);
void destroyPoolAllocator(PoolAllocator* pa);
void* poolAllocate(PoolAllocator* pa);
void poolFree(PoolAllocator* pa, void* p);
#if defined (__cplusplus)
}
#endif