mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 23:04:08 +10:00
Wrote value, chunk, memory sections, tested value
chunk and memory remain untested for now
This commit is contained in:
14
source/toy_memory.h
Normal file
14
source/toy_memory.h
Normal file
@@ -0,0 +1,14 @@
|
||||
#pragma once
|
||||
|
||||
#include "toy_common.h"
|
||||
|
||||
#define TOY_GROW_CAPACITY(capacity) \
|
||||
((capacity) < 8 ? 8 : (capacity) * 2)
|
||||
|
||||
#define TOY_GROW_ARRAY(type, pointer, oldSize, newSize) \
|
||||
(type*)Toy_reallocate(pointer, sizeof(type)*oldSize, sizeof(type)*newSize)
|
||||
|
||||
#define TOY_FREE_ARRAY(type, pointer, oldSize) \
|
||||
(type*)Toy_reallocate(pointer, sizeof(type)*oldSize, 0)
|
||||
|
||||
TOY_API void* Toy_reallocate(void* pointer, size_t oldSize, size_t newSize);
|
||||
Reference in New Issue
Block a user