1
0
mirror of https://github.com/janet-lang/janet synced 2024-11-28 11:09:54 +00:00

Define immediate comparison instructions for non-integers.

Previous, the instructions were defined only for values that
fit into 32 bit integers for legacy reasons.
This commit is contained in:
Calvin Rose 2021-02-08 11:41:48 -06:00
parent c941e5a8f4
commit 6a9bb0f4e4

View File

@ -780,7 +780,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) {
vm_compop( <=);
VM_OP(JOP_LESS_THAN_IMMEDIATE)
stack[A] = janet_wrap_boolean(janet_unwrap_integer(stack[B]) < CS);
stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) < (double) CS);
vm_pcnext();
VM_OP(JOP_GREATER_THAN)
@ -790,7 +790,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) {
vm_compop( >=);
VM_OP(JOP_GREATER_THAN_IMMEDIATE)
stack[A] = janet_wrap_boolean(janet_unwrap_integer(stack[B]) > CS);
stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) > (double) CS);
vm_pcnext();
VM_OP(JOP_EQUALS)
@ -798,7 +798,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) {
vm_pcnext();
VM_OP(JOP_EQUALS_IMMEDIATE)
stack[A] = janet_wrap_boolean(janet_unwrap_integer(stack[B]) == CS);
stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) == (double) CS);
vm_pcnext();
VM_OP(JOP_NOT_EQUALS)
@ -806,7 +806,7 @@ static JanetSignal run_vm(JanetFiber *fiber, Janet in) {
vm_pcnext();
VM_OP(JOP_NOT_EQUALS_IMMEDIATE)
stack[A] = janet_wrap_boolean(janet_unwrap_integer(stack[B]) != CS);
stack[A] = janet_wrap_boolean(janet_unwrap_number(stack[B]) != (double) CS);
vm_pcnext();
VM_OP(JOP_COMPARE)