[前][次][番号順一覧][スレッド一覧]

ruby-changes:55262

From: nobu <ko1@a...>
Date: Mon, 8 Apr 2019 12:33:01 +0900 (JST)
Subject: [ruby-changes:55262] nobu:r67468 (trunk): range.c: force hash values fixable

nobu	2019-04-08 12:26:29 +0900 (Mon, 08 Apr 2019)

  New Revision: 67468

  https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=67468

  Log:
    range.c: force hash values fixable
    
    * range.c (range_hash): force hash values fixable on LLP64
      environment.  [ruby-core:92194] [Bug #15757]

  Modified files:
    trunk/range.c
    trunk/test/ruby/test_range.rb
Index: range.c
===================================================================
--- range.c	(revision 67467)
+++ range.c	(revision 67468)
@@ -230,7 +230,7 @@ range_hash(VALUE range) https://github.com/ruby/ruby/blob/trunk/range.c#L230
     hash = rb_hash_uint(hash, EXCL(range) << 24);
     hash = rb_hash_end(hash);
 
-    return LONG2FIX(hash);
+    return ST2FIX(hash);
 }
 
 static void
Index: test/ruby/test_range.rb
===================================================================
--- test/ruby/test_range.rb	(revision 67467)
+++ test/ruby/test_range.rb	(revision 67468)
@@ -203,6 +203,7 @@ class TestRange < Test::Unit::TestCase https://github.com/ruby/ruby/blob/trunk/test/ruby/test_range.rb#L203
     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

--
ML: ruby-changes@q...
Info: http://www.atdot.net/~ko1/quickml/

[前][次][番号順一覧][スレッド一覧]