From c2dd2d268ed24e618d0f7ebab50a9f088cd272ac Mon Sep 17 00:00:00 2001 From: usa Date: Tue, 4 Oct 2016 16:25:01 +0000 Subject: * internal.h (ST2FIX): new macro to convert st_index_t to Fixnum. a hash value of Object might be Bignum, but it causes many troubles expecially the Object is used as a key of a hash. so I've gave up to do so. * array.c (rb_ary_hash): use above macro. * bignum.c (rb_big_hash): ditto. * hash.c (rb_obj_hash, rb_hash_hash): ditto. * numeric.c (rb_dbl_hash): ditto. * proc.c (proc_hash): ditto. * re.c (rb_reg_hash, match_hash): ditto. * string.c (rb_str_hash_m): ditto. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56340 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- string.c | 8 +------- 1 file changed, 1 insertion(+), 7 deletions(-) (limited to 'string.c') diff --git a/string.c b/string.c index 57b4e9ac15..56f1432bde 100644 --- a/string.c +++ b/string.c @@ -2963,13 +2963,7 @@ static VALUE rb_str_hash_m(VALUE str) { st_index_t hval = rb_str_hash(str); -#if SIZEOF_LONG == SIZEOF_VOIDP - return LONG2FIX((long)hval); -#elif SIZEOF_LONG_LONG == SIZEOF_VOIDP - return LL2NUM((LONG_LONG)hval); -#else -# error unsupported platform -#endif + return ST2FIX(hval); } #define lesser(a,b) (((a)>(b))?(b):(a)) -- cgit v1.2.3