From 8747e4715efb0ba80e52f558ee93ac0857a7f41d Mon Sep 17 00:00:00 2001 From: usa Date: Sat, 1 Oct 2016 17:06:21 +0000 Subject: * 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. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56320 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 8 +++++++- 1 file changed, 7 insertions(+), 1 deletion(-) (limited to 'string.c') diff --git a/string.c b/string.c index 8a57bc9048..1c27c89e8b 100644 --- a/string.c +++ b/string.c @@ -2963,7 +2963,13 @@ static VALUE 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)) -- cgit v1.2.3