< prev index next >

src/hotspot/share/libadt/dict.cpp

Print this page
rev 50962 : [mq]: 8207011

*** 303,315 **** // multiplication requires only shifts and adds. Characters are required to // be in the range 0-127 (I double & add 1 to force oddness). Keys are // limited to MAXID characters in length. Experimental evidence on 150K of // C text shows excellent spreading of values for any size hash table. int hashstr(const void *t) { ! register char c, k = 0; ! register int32_t sum = 0; ! register const char *s = (const char *)t; while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1 c = (c<<1)+1; // Characters are always odd! sum += c + (c<<shft[k++]); // Universal hash function } --- 303,315 ---- // multiplication requires only shifts and adds. Characters are required to // be in the range 0-127 (I double & add 1 to force oddness). Keys are // limited to MAXID characters in length. Experimental evidence on 150K of // C text shows excellent spreading of values for any size hash table. int hashstr(const void *t) { ! char c, k = 0; ! int32_t sum = 0; ! const char *s = (const char *)t; while( ((c = *s++) != '\0') && (k < MAXID-1) ) { // Get characters till null or MAXID-1 c = (c<<1)+1; // Characters are always odd! sum += c + (c<<shft[k++]); // Universal hash function }
< prev index next >