summaryrefslogtreecommitdiff
path: root/numeric.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-04 20:57:02 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2006-09-04 20:57:02 +0000
commitdfac39ff8d6a080f5cb3faea44b53dbdec5e06ae (patch)
tree1fa2322bd80516cece3046c76a820c91afd51c1e /numeric.c
parent401ff253ef38889be85d9cc3f06ef98d7c2a35a2 (diff)
* numeric.c (flo_hash): improve collision. fixed: [ruby-dev:29352]
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_1_8@10864 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c2
1 files changed, 1 insertions, 1 deletions
diff --git a/numeric.c b/numeric.c
index f6f1d3b..c5e9893 100644
--- a/numeric.c
+++ b/numeric.c
@@ -870,7 +870,7 @@ flo_hash(num)
if (d == 0) d = fabs(d);
c = (char*)&d;
for (hash=0, i=0; i<sizeof(double);i++) {
- hash += c[i] * 971;
+ hash = (hash * 971) ^ (unsigned char)c[i];
}
if (hash < 0) hash = -hash;
return INT2FIX(hash);