ruby-changes:44248
From: nobu <ko1@a...>
Date: Sun, 2 Oct 2016 07:51:39 +0900 (JST)
Subject: [ruby-changes:44248] nobu:r56321 (trunk): string.c: negative hash
nobu 2016-10-02 07:51:23 +0900 (Sun, 02 Oct 2016) New Revision: 56321 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56321 Log: string.c: negative hash * string.c (rb_str_hash_m): hash values may be negative. Modified files: trunk/ChangeLog trunk/string.c Index: ChangeLog =================================================================== --- ChangeLog (revision 56320) +++ ChangeLog (revision 56321) @@ -1,3 +1,7 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +Sun Oct 2 07:51:20 2016 Nobuyoshi Nakada <nobu@r...> + + * string.c (rb_str_hash_m): hash values may be negative. + Sun Oct 2 02:04:12 2016 NAKAMURA Usaku <usa@r...> * string.c (rb_str_hash_m): st_index_t is not guaranteed as the same Index: string.c =================================================================== --- string.c (revision 56320) +++ string.c (revision 56321) @@ -2964,9 +2964,9 @@ rb_str_hash_m(VALUE str) https://github.com/ruby/ruby/blob/trunk/string.c#L2964 { st_index_t hval = rb_str_hash(str); #if SIZEOF_LONG == SIZEOF_VOIDP - return ULONG2NUM(hval); + return LONG2FIX((long)hval); #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP - return ULL2NUM(hval); + return LL2NUM((LONG_LONG)hval); #else # error unsupported platform #endif -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/