diff --git a/ChangeLog b/ChangeLog index acba651c9a..ab621f920e 100644 --- a/ChangeLog +++ b/ChangeLog @@ -1,3 +1,7 @@ +Sun Oct 2 07:51:20 2016 Nobuyoshi Nakada + + * string.c (rb_str_hash_m): hash values may be negative. + Sun Oct 2 02:04:12 2016 NAKAMURA Usaku * string.c (rb_str_hash_m): st_index_t is not guaranteed as the same diff --git a/string.c b/string.c index 1c27c89e8b..57b4e9ac15 100644 --- a/string.c +++ b/string.c @@ -2964,9 +2964,9 @@ rb_str_hash_m(VALUE str) { 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