Tests are passing, added preserveScope to VM API

This commit is contained in:
2025-01-31 13:51:53 +11:00
parent bfed4e23f3
commit 481d17f040
10 changed files with 360 additions and 406 deletions

View File

@@ -10,10 +10,10 @@
//utils
static void expand(Toy_ModuleBundle* bundle, unsigned int amount) {
if (bundle->count + amount > bundle->capacity) {
bundle->capacity = 0;
bundle->capacity = 8; //DON'T bitshift zero
while (bundle->count + amount > bundle->capacity) { //expand as much as needed
bundle->capacity >>= 2;
bundle->capacity <<= 2;
}
bundle->ptr = realloc(bundle->ptr, bundle->capacity);