off by one overflow check bug
authorbrian <brian@brianweb.net>
Fri, 28 May 2004 19:12:16 +0000 (19:12 +0000)
committerbrian <brian@brianweb.net>
Fri, 28 May 2004 19:12:16 +0000 (19:12 +0000)
darcs-hash:20040528191216-24bed-bb5334ec0e3a5cf54ffad1cc8cea7204949c05e5.gz

src/org/ibex/classgen/MethodGen.java

index de4196b..36523f3 100644 (file)
@@ -434,7 +434,7 @@ public class MethodGen implements CGConst {
                             if(iarg < -128 || iarg >= 256) throw new ClassGen.Exn("overflow of s/u1 option");
                             o.writeByte(iarg);
                         } else if(argLength == 2) {
-                            if(iarg < -32767 || iarg >= 65536) throw new ClassGen.Exn("overflow of s/u2 option"); 
+                            if(iarg < -32768 || iarg >= 65536) throw new ClassGen.Exn("overflow of s/u2 option"); 
                             o.writeShort(iarg);
                         } else {
                             throw new Error("should never happen");