ufff
This commit is contained in:
parent
c8b8dd820e
commit
0e7fffcfe0
67 changed files with 154 additions and 65 deletions
11
src/vm_case_swap.c
Normal file
11
src/vm_case_swap.c
Normal file
|
|
@ -0,0 +1,11 @@
|
|||
case OP_SWAP: {
|
||||
if (vm->sp < 1) {
|
||||
fprintf(stderr, "Runtime error: stack underflow for SWAP\n");
|
||||
exit(1);
|
||||
}
|
||||
Value a = vm->stack[vm->sp];
|
||||
Value b = vm->stack[vm->sp - 1];
|
||||
vm->stack[vm->sp] = b;
|
||||
vm->stack[vm->sp - 1] = a;
|
||||
break;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue