This is the mail archive of the
java-discuss@sourceware.cygnus.com
mailing list for the Java project.
_Jv_HashCode
- To: Java Discuss List <java-discuss at sourceware dot cygnus dot com>
- Subject: _Jv_HashCode
- From: Tom Tromey <tromey at cygnus dot com>
- Date: 09 May 2000 19:00:11 -0600
- Reply-To: tromey at cygnus dot com
Current _Jv_HashCode is defined thusly:
inline jint
_Jv_HashCode (jobject obj)
{
return (jint) obj;
}
I wonder if this should be `(jint) obj >> 2' instead.
That would put more information in the low bits.
This matters in some situations. For instance, the interned string
hash table has a size that is a power of 2. In this case 3/4 of the
entries in this table will only be used when there are collisions.
Comments? Does hash code computation have to be maximally fast? Will
a shift cause problems? (To me it seems unlikely.)
Tom