summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 05:06:43 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 05:06:43 +0000
commit7a4c39c5f25c7bed475f65e45c76a646ad993d8b (patch)
tree7ef9f1fb6b8f97fe58efe093d8a928ddefe8dc42
parentb29f55c5acc4addabc7ffa94e022e40b36255abb (diff)
struct.c: force hash values fixable
* struct.c (rb_struct_hash): force hash values fixable on LLP64 environment. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67470 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--struct.c2
-rw-r--r--test/ruby/test_struct.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/struct.c b/struct.c
index c0cef33eb7..b85f7c035e 100644
--- a/struct.c
+++ b/struct.c
@@ -1202,7 +1202,7 @@ rb_struct_hash(VALUE s)
h = rb_hash_uint(h, NUM2LONG(n));
}
h = rb_hash_end(h);
- return INT2FIX(h);
+ return ST2FIX(h);
}
static VALUE
diff --git a/test/ruby/test_struct.rb b/test/ruby/test_struct.rb
index 4748419d6b..db3d767edd 100644
--- a/test/ruby/test_struct.rb
+++ b/test/ruby/test_struct.rb
@@ -275,6 +275,7 @@ module TestStruct
klass = @Struct.new(:a)
o = klass.new(1)
assert_kind_of(Integer, o.hash)
+ assert_kind_of(String, o.hash.to_s)
end
def test_eql