mirror of
https://github.com/krgamestudios/Toy.git
synced 2026-04-15 14:54:07 +10:00
Multiple bugfixes, read more
* expand() will only touch the memory once * fixed missing if-else cascade at toy_routine.c:90 * unary negate will not optimise numbers unless the '-' character is immediately prior * fixed broken test for unary negation of groups
This commit is contained in:
@@ -9,10 +9,12 @@
|
||||
|
||||
//utils
|
||||
static void expand(Toy_Bytecode* bc, int amount) {
|
||||
while (bc->count + amount > bc->capacity) {
|
||||
if (bc->count + amount > bc->capacity) {
|
||||
int oldCapacity = bc->capacity;
|
||||
|
||||
bc->capacity = TOY_GROW_CAPACITY(oldCapacity);
|
||||
while (bc->count + amount > bc->capacity) {
|
||||
bc->capacity = TOY_GROW_CAPACITY(bc->capacity);
|
||||
}
|
||||
bc->ptr = TOY_GROW_ARRAY(unsigned char, bc->ptr, oldCapacity, bc->capacity);
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user