diff options
author | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-29 05:53:35 +0000 |
---|---|---|
committer | nobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2015-07-29 05:53:35 +0000 |
commit | efc7a3a712f84e3f59f09a89a82f2c36081f0f43 (patch) | |
tree | b12e550b6378890ec883b9c3757bfd15d24da54f /hash.c | |
parent | 8e613749f45fb2c471690847b21c2f7122ca148c (diff) | |
download | ruby-efc7a3a712f84e3f59f09a89a82f2c36081f0f43.tar.gz |
hash.c: fix float hash
* 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/trunk@51425 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 6 |
1 files changed, 4 insertions, 2 deletions
@@ -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) return RSYMBOL(a)->hashval; } 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); |