ruby-changes:44247
From: usa <ko1@a...>
Date: Sun, 2 Oct 2016 02:06:25 +0900 (JST)
Subject: [ruby-changes:44247] usa:r56320 (trunk): * string.c (rb_str_hash_m): st_index_t is not guaranteed as the same
usa 2016-10-02 02:06:21 +0900 (Sun, 02 Oct 2016) New Revision: 56320 https://svn.ruby-lang.org/cgi-bin/viewvc.cgi?view=revision&revision=56320 Log: * string.c (rb_str_hash_m): st_index_t is not guaranteed as the same size with int, and of course also not guaranteed the value can be Fixnum. Modified files: trunk/ChangeLog trunk/string.c Index: string.c =================================================================== --- string.c (revision 56319) +++ string.c (revision 56320) @@ -2963,7 +2963,13 @@ static VALUE https://github.com/ruby/ruby/blob/trunk/string.c#L2963 rb_str_hash_m(VALUE str) { st_index_t hval = rb_str_hash(str); - return INT2FIX(hval); +#if SIZEOF_LONG == SIZEOF_VOIDP + return ULONG2NUM(hval); +#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP + return ULL2NUM(hval); +#else +# error unsupported platform +#endif } #define lesser(a,b) (((a)>(b))?(b):(a)) Index: ChangeLog =================================================================== --- ChangeLog (revision 56319) +++ ChangeLog (revision 56320) @@ -1,3 +1,9 @@ https://github.com/ruby/ruby/blob/trunk/ChangeLog#L1 +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 + size with int, and of course also not guaranteed the value can be + Fixnum. + Sun Oct 2 02:03:06 2016 NAKAMURA Usaku <usa@r...> * numeric.c (rb_fix2str): detect unnormalized Fixnum value. -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/