* string.c (rb_str_hash_m): hash values may be negative.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56321 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
nobu 2016-10-01 22:51:23 +00:00
Родитель 7a44019031
Коммит 63d77c2a1b
2 изменённых файлов: 6 добавлений и 2 удалений

Просмотреть файл

@ -1,3 +1,7 @@
Sun Oct 2 07:51:20 2016 Nobuyoshi Nakada <nobu@ruby-lang.org>
* string.c (rb_str_hash_m): hash values may be negative.
Sun Oct 2 02:04:12 2016 NAKAMURA Usaku <usa@ruby-lang.org> Sun Oct 2 02:04:12 2016 NAKAMURA Usaku <usa@ruby-lang.org>
* string.c (rb_str_hash_m): st_index_t is not guaranteed as the same * string.c (rb_str_hash_m): st_index_t is not guaranteed as the same

Просмотреть файл

@ -2964,9 +2964,9 @@ rb_str_hash_m(VALUE str)
{ {
st_index_t hval = rb_str_hash(str); st_index_t hval = rb_str_hash(str);
#if SIZEOF_LONG == SIZEOF_VOIDP #if SIZEOF_LONG == SIZEOF_VOIDP
return ULONG2NUM(hval); return LONG2FIX((long)hval);
#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP #elif SIZEOF_LONG_LONG == SIZEOF_VOIDP
return ULL2NUM(hval); return LL2NUM((LONG_LONG)hval);
#else #else
# error unsupported platform # error unsupported platform
#endif #endif