changeset 45:c42d6dc7df68

Fixed code generation error with indirect indexing using 8 or 16 bit offsets from X,Y,U,S
author lost@l-w.ca
date Mon, 04 Apr 2011 18:17:31 -0600
parents 1bff302e62a3
children 534bfa3389b0
files lwasm/insn_indexed.c
diffstat 1 files changed, 4 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_indexed.c	Mon Apr 04 18:05:18 2011 -0600
+++ b/lwasm/insn_indexed.c	Mon Apr 04 18:17:31 2011 -0600
@@ -349,7 +349,7 @@
 				case 1:
 				case 2:
 				case 3:
-					pb = 0x89 | ((l -> pb & 0x03) << 5) | (0x10 * (l -> pb & 0x80));
+					pb = 0x89 | ((l -> pb & 0x03) << 5) | ((l -> pb & 0x80) ? 0x10 : 0);
 					break;
 			
 				case 4: // W
@@ -377,7 +377,7 @@
 				case 1:
 				case 2:
 				case 3:
-					pb = 0x88 | ((l -> pb & 0x03) << 5) | (0x10 * (l -> pb & 0x80));
+					pb = 0x88 | ((l -> pb & 0x03) << 5) | ((l -> pb & 0x80) ? 0x10 : 0);
 					break;
 			
 				case 4: // W
@@ -436,7 +436,7 @@
 			case 1:
 			case 2:
 			case 3:
-				pb = 0x89 | (l -> pb & 0x03) << 5 | (0x10 * (l -> pb & 0x80));
+				pb = 0x89 | (l -> pb & 0x03) << 5 | ((l -> pb & 0x80) ? 0x10 : 0);
 				break;
 			
 			case 4: // W
@@ -462,7 +462,7 @@
 			case 1:
 			case 2:
 			case 3:
-				pb = 0x88 | (l -> pb & 0x03) << 5 | (0x10 * (l -> pb & 0x80));
+				pb = 0x88 | (l -> pb & 0x03) << 5 | ((l -> pb & 0x80) ? 0x10 : 0);
 				break;
 			
 			case 4: // W