summaryrefslogtreecommitdiff
path: root/rational.c
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-25 04:44:36 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2009-07-25 04:44:36 +0000
commitd6ab828369b8ab6995b47abd9ab5982618c2d334 (patch)
tree8ca4432cd0897c37d450a98f305897c7cbb567c8 /rational.c
parent4fd615943ed879a3694bd986f48a52486c7c52e1 (diff)
* complex.c (nucomp_hash), rational.c (nurat_hash): not to use
hash value of class so that equality against subclasses can work. [ruby-dev:38850] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@24270 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
Diffstat (limited to 'rational.c')
-rw-r--r--rational.c7
1 files changed, 3 insertions, 4 deletions
diff --git a/rational.c b/rational.c
index e5ae730..ee5c448 100644
--- a/rational.c
+++ b/rational.c
@@ -1360,15 +1360,14 @@ nurat_to_r(VALUE self)
static VALUE
nurat_hash(VALUE self)
{
- long v, h[3];
+ long v, h[2];
VALUE n;
get_dat1(self);
- h[0] = rb_hash(rb_obj_class(self));
n = rb_hash(dat->num);
- h[1] = NUM2LONG(n);
+ h[0] = NUM2LONG(n);
n = rb_hash(dat->den);
- h[2] = NUM2LONG(n);
+ h[1] = NUM2LONG(n);
v = rb_memhash(h, sizeof(h));
return LONG2FIX(v);
}