aboutsummaryrefslogtreecommitdiffstats
path: root/numeric.c
diff options
context:
space:
mode:
authorko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-07 00:45:00 +0000
committerko1 <ko1@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2016-11-07 00:45:00 +0000
commite49a472aad43e92e7b71ed38d6c7c091645a90f6 (patch)
tree311920522c27ab515ddfda5d1f45d1d3f68f142a /numeric.c
parent599de5be6e006743739834da0c5d484b47988b2f (diff)
downloadruby-e49a472aad43e92e7b71ed38d6c7c091645a90f6.tar.gz
Introduce table improvement by Vladimir Makarov <vmakarov@redhat.com>.
[Feature #12142] See header of st.c for improvment details. You can see all of code history here: <https://github.com/vnmakarov/ruby/tree/hash_tables_with_open_addressing> This improvement is discussed at <https://bugs.ruby-lang.org/issues/12142> with many people, especially with Yura Sokolov. * st.c: improve st_table. * include/ruby/st.h: ditto. * internal.h, numeric.c, hash.c (rb_dbl_long_hash): extract a function. * ext/-test-/st/foreach/foreach.c: catch up this change. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56650 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'numeric.c')
-rw-r--r--numeric.c7
1 files changed, 1 insertions, 6 deletions
diff --git a/numeric.c b/numeric.c
index 3620f1f3b8..6ab3593cfc 100644
--- a/numeric.c
+++ b/numeric.c
@@ -1421,12 +1421,7 @@ flo_hash(VALUE num)
VALUE
rb_dbl_hash(double d)
{
- st_index_t hash;
-
- /* normalize -0.0 to 0.0 */
- if (d == 0.0) d = 0.0;
- hash = rb_memhash(&d, sizeof(d));
- return ST2FIX(hash);
+ return LONG2FIX(rb_dbl_long_hash (d));
}
VALUE