aboutsummaryrefslogtreecommitdiffstats
path: root/hash.c
diff options
context:
space:
mode:
Diffstat (limited to 'hash.c')
-rw-r--r--hash.c7
1 files changed, 5 insertions, 2 deletions
diff --git a/hash.c b/hash.c
index 2d99df3ce0..f3c621acee 100644
--- a/hash.c
+++ b/hash.c
@@ -94,8 +94,11 @@ rb_any_hash(a)
default:
DEFER_INTS;
hval = rb_funcall(a, hash, 0);
- if (!FIXNUM_P(hval)) {
- hval = rb_funcall(hval, '%', 1, INT2FIX(65439));
+ if (FIXNUM_P(hval)) {
+ hval %= 536870917;
+ }
+ else {
+ hval = rb_funcall(hval, '%', 1, INT2FIX(536870917));
}
ENABLE_INTS;
return (int)FIX2LONG(hval);