hV *first_x = &((hV*)vm->xsp)[-1];
hV *second_x = &((hV*)vm->xsp)[-2];
+ hV xtmp = *first_x;
+ if (*first_v == first_x) {
+ *first_x = *second_x;
+ *first_v = second_x;
+ }
+
+ if (*second_v == second_x) {
+ *second_x = xtmp;
+ *second_v = first_x;
+ }
+
hV *vtmp = *first_v;
*first_v = *second_v;
*second_v = vtmp;
-
- hV xtmp = *first_x;
- *first_x = *second_x;
- *second_x = xtmp;
}
hV *peek_stack(hVm vm, isize offset) {
}
}
-hV sbV_incr(const hV *a) {
+void sbV_incr(hV *a) {
if (a->type == IT_INTEGER) {
- return sbV_int(a->integer + 1);
+ a->integer += 1;
} else {
PANIC("todo");
}
}
-hV sbV_decr(const hV *a) {
+void sbV_decr(hV *a) {
if (a->type == IT_INTEGER) {
- return sbV_int(a->integer - 1);
+ a->integer -= 1;
} else {
PANIC("todo");
}
hV sbV_floordiv(const hV *a, const hV *b);
-hV sbV_incr(const hV *a);
+void sbV_incr(hV *a);
-hV sbV_decr(const hV *a);
+void sbV_decr(hV *a);
hV sbV_eq(const hV *a, const hV *b);