diff lwlib/lw_expr.h @ 366:433dbc18fb41

Make byte overflow detection for 8 bit immediate not fail with COM operator This is a horrible hack. Add a quick and dirty context to expression parsing so that it knows whether an 8 bit or 16 bit complement is required. The 8 bit complement will just discard anything above bit 7. When returning an operator back with lwasm_whichop(), the result will still be "COM" which should allow other things to keep working as they already do. This does prevent byte overflows when the complement operator is used, however, and since those were introduced, there were problems building Nitros9 among other things. This fix allows Nitros9 to build again.
author William Astle <lost@l-w.ca>
date Tue, 02 Jun 2015 20:58:14 -0600
parents 4130ffdeb5c8
children 8e25147c2aa8
line wrap: on
line diff
--- a/lwlib/lw_expr.h	Tue Jun 02 20:08:58 2015 -0600
+++ b/lwlib/lw_expr.h	Tue Jun 02 20:58:14 2015 -0600
@@ -51,6 +51,7 @@
 	lw_expr_oper_or,			// boolean or
 	lw_expr_oper_neg,			// unary negation, 2's complement
 	lw_expr_oper_com,			// unary 1's complement
+	lw_expr_oper_com8,			// 8 bit complement
 	lw_expr_oper_none = 0
 };
 
@@ -111,6 +112,8 @@
 
 extern int lw_expr_operandcount(lw_expr_t e);
 
+extern void lw_expr_setwidth(int w);
+
 // run a function on all terms in an expression; if the function
 // returns non-zero for any term, return non-zero, else return
 // zero