summaryrefslogtreecommitdiff
path: root/string.c
diff options
context:
space:
mode:
authorknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-01 16:16:31 +0000
committerknu <knu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2003-11-01 16:16:31 +0000
commitfe85bcd644d60f7665ed2688b91c28c3def01526 (patch)
tree29db2cd02a6139cde66ebee2ad7fe75f39a86dae /string.c
parent92160dc6d0ca0ce81f551c2ec300b570b44b945c (diff)
* 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 'string.c')
-rw-r--r--string.c8
1 files changed, 6 insertions, 2 deletions
diff --git a/string.c b/string.c
index 29c3cea..2d991f6 100644
--- a/string.c
+++ b/string.c
@@ -744,9 +744,13 @@ rb_str_hash(str)
}
#elif HASH_PERL
while (len--) {
- key = key*33 + *p++;
+ key += *p++;
+ key += (key << 10);
+ key ^= (key >> 6);
}
- key = key + (key>>5);
+ key += (key << 3);
+ key ^= (key >> 11);
+ key += (key << 15);
#else
while (len--) {
key = key*65599 + *p;