1
0
Fork 0
forked from fun/fun

Some more internal optimizations. (0.41.15)

This commit is contained in:
Johannes Findeisen 2026-05-26 05:13:04 +02:00
commit a5de8b167a
13 changed files with 194 additions and 25 deletions

View file

@ -23,10 +23,7 @@
*/
case OP_SWAP: {
if (vm->sp < 1) {
fprintf(stderr, "Runtime error: stack underflow for SWAP\n");
exit(1);
}
vm_require_stack(vm, 2);
Value a = vm->stack[vm->sp];
Value b = vm->stack[vm->sp - 1];
vm->stack[vm->sp] = b;