classpath-patches
[Top][All Lists]
Advanced

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

[cp-patches] Patch: FYI: fixlet in Long


From: Tom Tromey
Subject: [cp-patches] Patch: FYI: fixlet in Long
Date: 18 Sep 2005 16:20:49 -0600
User-agent: Gnus/5.09 (Gnus v5.9.0) Emacs/21.3.50

I'm checking this in.

This fixes a bug in one of the new 1.5 Long methods that was pointed
out by some Mauve tests I wrote.

Tom

Index: ChangeLog
from  Tom Tromey  <address@hidden>

        * java/lang/Long.java (reverse): Correctly handle sign extension.

Index: java/lang/Long.java
===================================================================
RCS file: /cvsroot/classpath/classpath/java/lang/Long.java,v
retrieving revision 1.22
diff -u -r1.22 Long.java
--- java/lang/Long.java 17 Sep 2005 21:58:41 -0000      1.22
+++ java/lang/Long.java 18 Sep 2005 22:24:48 -0000
@@ -657,9 +657,9 @@
    */
   public static long reverse(long val)
   {
-    int hi = Integer.reverse((int) val);
-    int lo = Integer.reverse((int) (val >>> 32));
-    return (((long) hi) << 32) | lo;
+    long hi = Integer.reverse((int) val) & 0xffffffffL;
+    long lo = Integer.reverse((int) (val >>> 32)) & 0xffffffffL;
+    return (hi << 32) | lo;
   }
 
   /**




reply via email to

[Prev in Thread] Current Thread [Next in Thread]