This is the mail archive of the java-patches@gcc.gnu.org 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]
Other format: [Raw text]

Patch: FYI: IdentityHashMap fix


I'm checking this in.

This bug was reintroduced during some earlier IdentityHashMap changes.

Tom

Index: ChangeLog
from  Tom Tromey  <tromey@redhat.com>
	* java/util/IdentityHashMap.java (IdentityHashMap): Removed
	commented code.
	(hash): Correctly compute initial value for `h'.

Index: java/util/IdentityHashMap.java
===================================================================
RCS file: /cvs/gcc/gcc/libjava/java/util/IdentityHashMap.java,v
retrieving revision 1.5
diff -u -r1.5 IdentityHashMap.java
--- java/util/IdentityHashMap.java 2001/12/15 07:47:02 1.5
+++ java/util/IdentityHashMap.java 2002/01/16 20:53:36
@@ -1,6 +1,6 @@
 /* IdentityHashMap.java -- a class providing a hashtable data structure,
    mapping Object --> Object, which uses object identity for hashing.
-   Copyright (C) 2001 Free Software Foundation, Inc.
+   Copyright (C) 2001, 2002 Free Software Foundation, Inc.
 
 This file is part of GNU Classpath.
 
@@ -153,8 +153,6 @@
       max = 2;
     table = new Object[2 * max];
     Arrays.fill(table, emptyslot);
-    // This is automatically set.
-    // size = 0;
     threshold = max / 4 * 3;
   }
 
@@ -633,7 +631,7 @@
     // By requiring at least 2 key/value slots, and rehashing at 75%
     // capacity, we guarantee that there will always be either an emptyslot
     // or a tombstone somewhere in the table.
-    int h = 2 * Math.abs(System.identityHashCode(key) % table.length);
+    int h = 2 * Math.abs(System.identityHashCode(key) % (table.length / 2));
     int del = -1;
     int save = h;
 


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