This is the mail archive of the java-patches@sourceware.cygnus.com mailing list for the Java project.


Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]

Re:+libgcj/23


This seems to be a bit-shifting overflow in BitSet.java (the "1"
constants are treated as int by default and need to be explicitly
specified as long).

Patch follows.

regards

  [ bryce ]


===================================================================
RCS file: /cvs/java/libgcj/libjava/java/util/BitSet.java,v
retrieving revision 1.1.1.1
diff -u -r1.1.1.1 BitSet.java
--- BitSet.java 1999/04/07 14:52:41   1.1.1.1
+++ BitSet.java 1999/08/11 09:25:36
@@ -56,7 +56,7 @@
       int bit = pos % 64;
       int offset = pos / 64;
       ensure (offset);
-      bits[offset] &= ~ (1 << bit);
+      bits[offset] &= ~ (1L << bit);
     }

   public Object clone ()
@@ -97,7 +97,7 @@
       if (offset >= bits.length)
  return false;

-      return (bits[offset] & (1 << bit)) == 0 ? false : true;
+      return (bits[offset] & (1L << bit)) == 0 ? false : true;
     }

   public int hashCode ()
@@ -125,7 +125,7 @@
       int bit = pos % 64;
       int offset = pos / 64;
       ensure (offset);
-      bits[offset] |= 1 << bit;
+      bits[offset] |= 1L << bit;
     }

   public int size ()

Index Nav: [Date Index] [Subject Index] [Author Index] [Thread Index]
Message Nav: [Date Prev] [Date Next] [Thread Prev] [Thread Next]