changeset 242:ea092ebc5323

Fix thinko with algorithm improvement. Fix error where DP addressing would be selected by range calculation even when DP addressing is not known to be valid.
author William Astle <lost@l-w.ca>
date Sun, 23 Sep 2012 13:11:34 -0600
parents d0e9dbe9afbe
children 65510f1574e4
files lwasm/insn_gen.c
diffstat 1 files changed, 20 insertions(+), 4 deletions(-) [+]
line wrap: on
line diff
--- a/lwasm/insn_gen.c	Sun Sep 23 13:06:43 2012 -0600
+++ b/lwasm/insn_gen.c	Sun Sep 23 13:11:34 2012 -0600
@@ -133,8 +133,16 @@
 				l -> lint2 = 2;
 				goto out;
 			}
-			l -> lint2 = 0;
-			goto out;
+			if (min == max && (l -> dpval & 0xff) == min)
+			{
+				l -> lint2 = 0;
+				goto out;
+			}
+			// if here, we don't know if the value is in the DP or not
+			{
+				l -> lint2 = -1;
+				goto out;
+			}
 		}
 	}
 
@@ -206,8 +214,16 @@
 				l -> lint2 = 2;
 				goto out;
 			}
-			l -> lint2 = 0;
-			goto out;
+			if (min == max && (l -> dpval & 0xff) == min)
+			{
+				l -> lint2 = 0;
+				goto out;
+			}
+			// if here, we don't know if the value is in the DP or not
+			{
+				l -> lint2 = -1;
+				goto out;
+			}
 		}
 	}