shithub: rgbds

Download patch

ref: 7a45fc68d9d6eedc7413fda0c421785e227e244d
parent: 9faa5c7a9e17fb112d8a2d2156cc82070c8053d1
author: ISSOtm <[email protected]>
date: Sun Sep 8 17:12:31 EDT 2019

Fix incorrect evaluation of && and ||
f29d768 forgot to switch these two `expr->nVal` to `src1->nVal`
This won't break anything, since this wasn't published yet.
I checked, and didn't see any other missed changes.

Reported by pret, I confirmed that `1 && 1` evaluated to 0.

--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -233,7 +233,7 @@
 	       const struct Expression *src2)
 {
 	joinexpr();
-	expr->nVal = (expr->nVal || src2->nVal);
+	expr->nVal = (src1->nVal || src2->nVal);
 	pushbyte(expr, RPN_LOGOR);
 	expr->nRPNPatchSize++;
 }
@@ -242,7 +242,7 @@
 		const struct Expression *src2)
 {
 	joinexpr();
-	expr->nVal = (expr->nVal && src2->nVal);
+	expr->nVal = (src1->nVal && src2->nVal);
 	pushbyte(expr, RPN_LOGAND);
 	expr->nRPNPatchSize++;
 }