diff options
author | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-01 16:16:31 +0000 |
---|---|---|
committer | knu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2003-11-01 16:16:31 +0000 |
commit | fe85bcd644d60f7665ed2688b91c28c3def01526 (patch) | |
tree | 29db2cd02a6139cde66ebee2ad7fe75f39a86dae /st.c | |
parent | 92160dc6d0ca0ce81f551c2ec300b570b44b945c (diff) | |
download | ruby-fe85bcd644d60f7665ed2688b91c28c3def01526.tar.gz |
* 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
Diffstat (limited to 'st.c')
-rw-r--r-- | st.c | 8 |
1 files changed, 6 insertions, 2 deletions
@@ -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; |