summaryrefslogtreecommitdiff
path: root/include/engine/memory.h
blob: 04c24d5dc2fec6aad4b72dac5c83105934213f39 (plain)
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
#ifndef MEMORY_H
#define MEMORY_H

#include "types.h"
// #include <stdlib.h>

typedef struct memory {
  void* data;
  usize size;
  usize pos;
  usize free;
} memory;

memory* memory_new(usize max_size);

/* Returns a pointer to the allocated data */
void* memory_allocate(memory* mem, usize size);

memory memory_init(void* data, usize size);

void memory_free(memory* mem, usize size);

void memory_clear(memory* mem);

#endif