< prev index next >
src/hotspot/share/adlc/dict2.cpp
Print this page
rev 50962 : [mq]: 8207011
*** 281,293 ****
// 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 int sum = 0;
! register const char *s = (const char *)t;
while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul
c = (char) ((c << 1) + 1); // Characters are always odd!
sum += c + (c << shft[k++]); // Universal hash function
}
--- 281,293 ----
// 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;
! int sum = 0;
! const char *s = (const char *)t;
while (((c = s[k]) != '\0') && (k < MAXID-1)) { // Get characters till nul
c = (char) ((c << 1) + 1); // Characters are always odd!
sum += c + (c << shft[k++]); // Universal hash function
}
< prev index next >