summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authornobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 03:26:29 +0000
committernobu <nobu@b2dd03c8-39d4-4d8f-98ff-823fe69b080e>2019-04-08 03:26:29 +0000
commitae6c195f30f76b1dc4a32a0a91d35fe80f6f85d3 (patch)
treeacacd2f11fc9f7fe404184ce5d6e234fb946a15d
parentb5baceda18fd6e93f8db29f79055a004f6419e1d (diff)
range.c: force hash values fixable
* range.c (range_hash): force hash values fixable on LLP64 environment. [ruby-core:92194] [Bug #15757] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@67468 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
-rw-r--r--range.c2
-rw-r--r--test/ruby/test_range.rb1
2 files changed, 2 insertions, 1 deletions
diff --git a/range.c b/range.c
index e5c6fbcf9db..4180a663aa5 100644
--- a/range.c
+++ b/range.c
@@ -230,7 +230,7 @@ range_hash(VALUE range)
hash = rb_hash_uint(hash, EXCL(range) << 24);
hash = rb_hash_end(hash);
- return LONG2FIX(hash);
+ return ST2FIX(hash);
}
static void
diff --git a/test/ruby/test_range.rb b/test/ruby/test_range.rb
index b704f8e1826..b1008d041f3 100644
--- a/test/ruby/test_range.rb
+++ b/test/ruby/test_range.rb
@@ -203,6 +203,7 @@ class TestRange < Test::Unit::TestCase
assert_not_equal((0..1).hash, (0...1).hash)
assert_equal((0..nil).hash, (0..nil).hash)
assert_not_equal((0..nil).hash, (0...nil).hash)
+ assert_kind_of(String, (0..1).hash.to_s)
end
def test_step