summaryrefslogtreecommitdiff
path: root/hash.c
diff options
context:
space:
mode:
authornagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 06:37:00 +0000
committernagachika <nagachika@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2015-08-14 06:37:00 +0000
commit640c135cbe3a0147cca1e9bf767d8cc5ae72b2bd (patch)
tree8d66866c59af1de3221dcb475344468cb6aa022a /hash.c
parent4fe4f46592c2ba4d42a25e8559d51307b24ee0af (diff)
merge revision(s) 51423,51425: [Backport #9381]
test_hash.rb: add assertions * test/ruby/test_hash.rb (test_wrapper_of_special_const): test other special obejcts. [Bug #9381] * hash.c (rb_any_hash): fix Float hash. rb_dbl_hash() returns a Fixnum, but not a long. [Bug #9381] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/branches/ruby_2_2@51572 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c6
1 files changed, 4 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index fb4c5a5d1b..9a68bd7507 100644
--- a/hash.c
+++ b/hash.c
@@ -142,7 +142,7 @@ rb_any_hash(VALUE a)
}
else if (FLONUM_P(a)) {
/* prevent pathological behavior: [Bug #10761] */
- return rb_dbl_hash(rb_float_value(a));
+ goto flt;
}
hnum = rb_objid_hash((st_index_t)a);
}
@@ -153,7 +153,9 @@ rb_any_hash(VALUE a)
hnum = rb_objid_hash((st_index_t)a);
}
else if (BUILTIN_TYPE(a) == T_FLOAT) {
- return rb_dbl_hash(rb_float_value(a));
+ flt:
+ hval = rb_dbl_hash(rb_float_value(a));
+ hnum = FIX2LONG(hval);
}
else {
hval = rb_hash(a);