ufff
This commit is contained in:
parent
c8b8dd820e
commit
0e7fffcfe0
67 changed files with 154 additions and 65 deletions
19
src/vm_case_neq.c
Normal file
19
src/vm_case_neq.c
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
case OP_NEQ: {
|
||||
Value b = pop_value(vm);
|
||||
Value a = pop_value(vm);
|
||||
int neq = 1;
|
||||
if (a.type == b.type) {
|
||||
switch (a.type) {
|
||||
case VAL_INT: neq = (a.i != b.i); break;
|
||||
case VAL_STRING: neq = (a.s && b.s) ? (strcmp(a.s, b.s) != 0) : (a.s != b.s); break;
|
||||
case VAL_FUNCTION: neq = (a.fn != b.fn); break;
|
||||
case VAL_NIL: neq = 0; break;
|
||||
default: neq = 1; break;
|
||||
}
|
||||
} else {
|
||||
neq = 1;
|
||||
}
|
||||
push_value(vm, make_int(neq ? 1 : 0));
|
||||
free_value(a); free_value(b);
|
||||
break;
|
||||
}
|
||||
Loading…
Add table
Add a link
Reference in a new issue