1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-12-14 02:23:55 +01:00
rpi-vk-driver/driver/PoolAllocator.h

27 lines
523 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
{
2020-06-08 19:54:57 +02:00
void* buf; //preallocated buffer
void* nextFreeBlock;
2018-05-10 23:10:35 +02:00
unsigned blockSize;
unsigned size; //size is exact multiple of block size
} PoolAllocator;
2020-06-08 19:54:57 +02:00
PoolAllocator createPoolAllocator(void* b, unsigned bs, unsigned s);
2018-08-26 15:11:43 +02:00
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