mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
* 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
This commit is contained in:
parent
401ff253ef
commit
dfac39ff8d
2 changed files with 5 additions and 1 deletions
|
|
@ -1,3 +1,7 @@
|
|||
Tue Sep 5 05:56:51 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* numeric.c (flo_hash): improve collision. fixed: [ruby-dev:29352]
|
||||
|
||||
Tue Sep 5 05:49:41 2006 Nobuyoshi Nakada <nobu@ruby-lang.org>
|
||||
|
||||
* file.c (path_check_0): check if sticky bit is set on parent
|
||||
|
|
|
|||
|
|
@ -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);
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue