[patch] Fix PR java/22189

Robin Green greenrd@greenrd.org
Mon Jun 27 13:37:00 GMT 2005


On Mon, Jun 27, 2005 at 01:00:28PM +0100, Andrew Haley wrote:
> OK, thanks.  The patch is fine with a ChangeLog entry.

D'oh! I keep forgetting ChangeLogs. Attached.

-------------- next part --------------
Index: ChangeLog
from  Robin Green  <greenrd@greenrd.org>

	PR java/22189
	* gnu/gcj/runtime/PersistentByteMap.java (init): Fix rounding error

--- /usr/src/debug/gcc-4.0.0-20050622/libjava/gnu/gcj/runtime/PersistentByteMap.java	2005-02-16 17:32:59.000000000 +0000
+++ gnu/gcj/runtime/PersistentByteMap.java	2005-06-27 12:38:18.000000000 +0100
@@ -175,10 +175,10 @@
       // We're going to make that size prime.  This isn't
       // strictly necessary but it can't hurt.
       //
-      // We expand the size by 3/2 because the hash table is
-      // intolerably slow when more than 2/3 full.
+      // We expand the size by 3/2 and round the result because
+      // the hash table is intolerably slow when more than 2/3 full.
       
-      BigInteger size = new BigInteger(Integer.toString(capacity * 3/2));
+      BigInteger size = new BigInteger(Integer.toString(((capacity*3)+1)/2));
       BigInteger two = BigInteger.ONE.add(BigInteger.ONE);
       
       if (size.getLowestSetBit() != 0) // A hard way to say isEven()
-------------- next part --------------
A non-text attachment was scrubbed...
Name: not available
Type: application/pgp-signature
Size: 189 bytes
Desc: not available
URL: <http://gcc.gnu.org/pipermail/java-patches/attachments/20050627/d70464bf/attachment.sig>


More information about the Java-patches mailing list