summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c13
1 files changed, 10 insertions, 3 deletions
diff --git a/rational.c b/rational.c
index c7437df86f..846e8bd586 100644
--- a/rational.c
+++ b/rational.c
@@ -1742,8 +1742,8 @@ nurat_rationalize(int argc, VALUE *argv, VALUE self)
}
/* :nodoc: */
-static VALUE
-nurat_hash(VALUE self)
+st_index_t
+rb_rational_hash(VALUE self)
{
st_index_t v, h[2];
VALUE n;
@@ -1754,9 +1754,16 @@ nurat_hash(VALUE self)
n = rb_hash(dat->den);
h[1] = NUM2LONG(n);
v = rb_memhash(h, sizeof(h));
- return ST2FIX(v);
+ return v;
+}
+
+static VALUE
+nurat_hash(VALUE self)
+{
+ return ST2FIX(rb_rational_hash(self));
}
+
static VALUE
f_format(VALUE self, VALUE (*func)(VALUE))
{