diff lwasm/insn_indexed.c @ 131:f2f3a4b0a25e

Fix fix for forced index offset sizes
author lost@l-w.ca
date Thu, 11 Aug 2011 22:58:27 -0600
parents 50d86baf4ea2
children 57c0210d578c
line wrap: on
line diff
--- a/lwasm/insn_indexed.c	Thu Aug 11 22:48:16 2011 -0600
+++ b/lwasm/insn_indexed.c	Thu Aug 11 22:58:27 2011 -0600
@@ -236,12 +236,13 @@
 		if (l -> lint == 1)
 		{
 			l -> pb = 0x88 | (rn << 5) | (indir ? 0x10 : 0);
+			return;
 		}
 		else if (l -> lint == 2)
 		{
 			l -> pb = 0x89 | (rn << 5) | (indir ? 0x10 : 0);
+			return;
 		}
-		return;
 	}
 
 	// nnnn,W is only 16 bit (or 0 bit)
@@ -337,7 +338,7 @@
 	
 	if (l -> len != -1)
 		return;
-	
+
 	e = lwasm_fetch_expr(l, 0);
 	if (!lw_expr_istype(e, lw_expr_type_int))
 	{
@@ -438,7 +439,7 @@
 			}
 			else
 			{
-				// we have X,Y,U,S and a possible 16 bit here
+				// we have X,Y,U,S and a possible 5 bit here
 				l -> lint = 0;
 				
 				if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40))
@@ -447,7 +448,7 @@
 				}	
 				else
 				{
-					pb = (l -> pb & 0x03) << 5 | (v & 0x1F);
+					pb = ((l -> pb & 0x03) << 5) | (v & 0x1F);
 				}
 				l -> pb = pb;
 				lw_expr_destroy(e2);
@@ -539,7 +540,7 @@
 		}
 		else
 		{
-			// we have X,Y,U,S and a possible 16 bit here
+			// we have X,Y,U,S and a possible 5 bit here
 			l -> lint = 0;
 			
 			if (v == 0 && !(CURPRAGMA(l, PRAGMA_NOINDEX0TONONE) || l -> pb & 0x40))
@@ -548,7 +549,7 @@
 			}
 			else
 			{
-				pb = (l -> pb & 0x03) << 5 | (v & 0x1F);
+				pb = ((l -> pb & 0x03) << 5) | (v & 0x1F);
 			}
 			l -> pb = pb;
 			return;