shithub: rgbds

Download patch

ref: 2e6f5ac679b6fec430023a1527fb4d4f9a8bfc82
parent: 7a45fc68d9d6eedc7413fda0c421785e227e244d
author: ISSOtm <[email protected]>
date: Sun Sep 8 17:42:17 EDT 2019

Fix unary NOT being broken
nVal wasn't being set, this made the operator a no-op on constant expressions

--- a/src/asm/rpn.c
+++ b/src/asm/rpn.c
@@ -65,7 +65,7 @@
 /*
  * Add a byte to the RPN expression
  */
-void pushbyte(struct Expression *expr, int b)
+void pushbyte(struct Expression *expr, uint8_t b)
 {
 	if (expr->nRPNLength == expr->nRPNCapacity) {
 		if (expr->nRPNCapacity == 0)
@@ -82,7 +82,7 @@
 			fatalerror("No memory for RPN expression");
 	}
 
-	expr->tRPN[expr->nRPNLength++] = b & 0xFF;
+	expr->tRPN[expr->nRPNLength++] = b;
 }
 
 /*
@@ -225,6 +225,7 @@
 void rpn_LOGNOT(struct Expression *expr, const struct Expression *src)
 {
 	*expr = *src;
+	expr->nVal = !expr->nVal;
 	pushbyte(expr, RPN_LOGUNNOT);
 	expr->nRPNPatchSize++;
 }