1
0
mirror of https://github.com/Yours3lf/rpi-vk-driver.git synced 2024-11-29 11:24:14 +01:00
rpi-vk-driver/driver/ConsecutivePoolAllocator.h
2020-03-05 21:18:26 +00:00

29 lines
832 B
C

#pragma once
#if defined (__cplusplus)
extern "C" {
#endif
#include "CustomAssert.h"
#include <stdint.h>
typedef struct ConsecutivePoolAllocator
{
char* buf; //preallocated buffer
uint32_t* nextFreeBlock;
unsigned blockSize;
unsigned size; //size is exact multiple of block size
} ConsecutivePoolAllocator;
ConsecutivePoolAllocator createConsecutivePoolAllocator(char* b, unsigned bs, unsigned s);
void destroyConsecutivePoolAllocator(ConsecutivePoolAllocator* pa);
void* consecutivePoolAllocate(ConsecutivePoolAllocator* pa, uint32_t numBlocks);
void consecutivePoolFree(ConsecutivePoolAllocator* pa, void* p, uint32_t numBlocks);
void* consecutivePoolReAllocate(ConsecutivePoolAllocator* pa, void* currentMem, uint32_t currNumBlocks);
void CPAdebugPrint(ConsecutivePoolAllocator* pa);
#if defined (__cplusplus)
}
#endif