mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* string.c (rb_str_hash): Update the HASH_PERL alternative hash
algorithm in sync with Perl 5.8. * st.c (strhash): Ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@4886 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
92160dc6d0
commit
fe85bcd644
3 changed files with 19 additions and 4 deletions
8
st.c
8
st.c
|
@ -536,10 +536,14 @@ strhash(string)
|
|||
register int val = 0;
|
||||
|
||||
while ((c = *string++) != '\0') {
|
||||
val = val*33 + c;
|
||||
val += c;
|
||||
val += (val << 10);
|
||||
val ^= (val >> 6);
|
||||
}
|
||||
val += (val << 3);
|
||||
val ^= (val >> 11);
|
||||
|
||||
return val + (val>>5);
|
||||
return val + (val << 15);
|
||||
#else
|
||||
register int val = 0;
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue