ref: 0729831074880cc65e2559baf111f0ac26d41a7e
parent: cd28127c3c59173a012a54a2c1a83a5acb96925d
author: Sigrid Solveig Haflínudóttir <sigrid@ftrv.se>
date: Sun Mar 2 20:48:55 EST 2025
vm: bikeshedding
--- a/src/vm.inc
+++ b/src/vm.inc
@@ -167,34 +167,33 @@
NEXT_OP;
}
-OP(OP_LT)
+OP(OP_LT) {
n = *ip++;
-LABEL(apply_lt):
- {
- int i = n;
- value_t a = sp[-i], b, v;
- for(v = sl_t; i > 1; a = b){
- i--;
- b = sp[-i];
- if(bothfixnums(a, b)){
- if((fixnum_t)a >= (fixnum_t)b){
- v = sl_nil;
- break;
- }
- }else{
- int x = numeric_compare(a, b, false, false, false);
- if(x > 1)
- x = numval(sl_compare(a, b, false));
- if(x >= 0){
- v = sl_nil;
- break;
- }
+LABEL(apply_lt):;
+ int i = n;
+ value_t a = sp[-i], b, v;
+ for(v = sl_t; i > 1; a = b){
+ i--;
+ b = sp[-i];
+ if(bothfixnums(a, b)){
+ if((fixnum_t)a >= (fixnum_t)b){
+ v = sl_nil;
+ break;
}
+ }else{
+ int x = numeric_compare(a, b, false, false, false);
+ if(x > 1)
+ x = numval(sl_compare(a, b, false));
+ if(x >= 0){
+ v = sl_nil;
+ break;
+ }
}
- sp -= n;
- *sp++ = v;
}
+ sp -= n;
+ *sp++ = v;
NEXT_OP;
+}
OP(OP_LOADV) {
value_t v = fn_vals(bp[-1]);
@@ -577,13 +576,9 @@
}
OP(OP_EQUAL) {
- value_t v;
- if(sp[-2] == sp[-1])
- v = sl_t;
- else
- v = sl_compare(sp[-2], sp[-1], true) == 0 ? sl_t : sl_nil;
- sp[-2] = v;
+ value_t a = sp[-2], b = sp[-1];
sp--;
+ sp[-1] = (a == b || sl_compare(a, b, true) == 0) ? sl_t : sl_nil;
NEXT_OP;
}
@@ -893,14 +888,8 @@
NEXT_OP;
OP(OP_EQV) {
- value_t v;
- if(sp[-2] == sp[-1])
- v = sl_t;
- else if(!leafp(sp[-2]) || !leafp(sp[-1]))
- v = sl_nil;
- else
- v = sl_compare(sp[-2], sp[-1], true) == 0 ? sl_t : sl_nil;
- sp[-2] = v;
+ value_t a = sp[-2], b = sp[-1];
+ sp[-2] = (a == b || (leafp(a) && leafp(b) && sl_compare(a, b, true) == 0)) ? sl_t : sl_nil;
sp--;
NEXT_OP;
}