This is the mail archive of the
java-patches@gcc.gnu.org
mailing list for the Java project.
[Patch] Fix BitSet.get(int, int) breakage.
- From: David Daney <ddaney at avtrex dot com>
- To: java-patches at gcc dot gnu dot org
- Date: Mon, 09 May 2005 17:26:55 -0700
- Subject: [Patch] Fix BitSet.get(int, int) breakage.
BitSet.get(int fromIndex, int toIndex) is broken for fromIndex not a
multiple of 64. One of the internal shift values was calculated
incorrectly.
This patch fixes the problem.
Tested on the gcc-4.0 branch with make -k check in libjava on
i686-pc-linux-gnu. No regressions.
I added a testcase for this to mauve.
2005-0509 David Daney <ddaney@avtrex.com>
* java/util/BitSet.java (get(int, int)): Fix breakage when
requested set doesn't start on a multiple of 64.
OK to commit to 4.0 branch and HEAD ?
David Daney.
Index: java/util/BitSet.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/BitSet.java,v
retrieving revision 1.19
diff -u -r1.19 BitSet.java
--- java/util/BitSet.java 17 Feb 2005 07:48:43 -0000 1.19
+++ java/util/BitSet.java 9 May 2005 23:39:19 -0000
@@ -380,7 +380,7 @@
}
int len = Math.min(hi_offset, bits.length - 1);
- int reverse = ~lo_bit;
+ int reverse = 64 - lo_bit;
int i;
for (i = 0; lo_offset < len; lo_offset++, i++)
bs.bits[i] = ((bits[lo_offset] >>> lo_bit)