RE: widening bug in IINC (was RE: cvs commit: jakarta-bcel/src/java/org/apache/bcel/generic RET.java)

"Ed Price" <[email protected]>
Newsgroups gmane.comp.jakarta.bcel.devel
Message-ID <000001c3f9bb$dba5c2a0$6600a8c0@xpc>
I wrote:

>  wide = (n > MAX_BYTE) || (c < MIN_BYTE) || (c > MAX_BYTE)

Not quite...  Make that:

  wide = (n > MAX_UNSIGNED_BYTE) || (c < MIN_BYTE) || (c > MAX_BYTE)

Corrected patch:

--- jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java.~1.3.~
2003-05-23 03:55:17.000000000 -0400
+++ jakarta-bcel/src/java/org/apache/bcel/generic/IINC.java	2004-02-22
21:47:58.000000000 -0500
@@ -106,8 +106,8 @@
   }
 
   private final void setWide() {
-    if(wide = ((n > org.apache.bcel.Constants.MAX_SHORT) ||
-	       (Math.abs(c) > Byte.MAX_VALUE)))
+    if(wide = ((n > org.apache.bcel.Constants.MAX_BYTE) ||
+               (c < Byte.MIN_VALUE) || (c > Byte.MAX_VALUE)))
       length = 6; // wide byte included  
     else
       length = 3;

Sorry for the confusion.
-Ed
lmpx.com only provides a reader for public news (NNTP) servers. It is not affiliated with the servers or forums shown here and is not responsible for the content of articles, which is written by their respective authors.