2018-05-11 21:59:22 +02:00
|
|
|
#pragma once
|
|
|
|
|
2018-05-13 16:29:15 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
extern "C" {
|
|
|
|
#endif
|
|
|
|
|
2018-05-11 21:59:22 +02:00
|
|
|
#include "CustomAssert.h"
|
|
|
|
|
|
|
|
#include <stdint.h>
|
|
|
|
|
|
|
|
typedef struct LinearAllocator
|
|
|
|
{
|
|
|
|
char* buf; //preallocated buffer
|
|
|
|
unsigned offset;
|
|
|
|
unsigned size;
|
|
|
|
} LinearAllocator;
|
|
|
|
|
2018-08-26 15:11:43 +02:00
|
|
|
LinearAllocator createLinearAllocator(char* b, unsigned s);
|
|
|
|
void destroyLinearAllocator(LinearAllocator* la);
|
|
|
|
void* linearAllocte(LinearAllocator* la, unsigned s);
|
|
|
|
void linearFree(LinearAllocator* la, void* p);
|
2018-05-11 21:59:22 +02:00
|
|
|
|
2018-05-13 16:29:15 +02:00
|
|
|
#if defined (__cplusplus)
|
|
|
|
}
|
|
|
|
#endif
|
|
|
|
|