aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
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 5b13d98ea3..9ae6d9564f 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)
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);