From cf8e8e6aa2b316cc1244bc05e1fbc73b36bb8ba5 Mon Sep 17 00:00:00 2001 From: usa Date: Fri, 22 Dec 2017 08:52:11 +0000 Subject: force hash values fixable * include/ruby/ruby.h (RB_ST2FIX): force fixable on LLP64 environment. * hash.c (any_hash): ditto. [ruby-core:84395] [Bug #14218] git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61413 b2dd03c8-39d4-4d8f-98ff-823fe69b080e --- include/ruby/ruby.h | 4 ++++ 1 file changed, 4 insertions(+) (limited to 'include') diff --git a/include/ruby/ruby.h b/include/ruby/ruby.h index 0959413dac..56aca0db5f 100644 --- a/include/ruby/ruby.h +++ b/include/ruby/ruby.h @@ -1575,7 +1575,11 @@ rb_num2char_inline(VALUE x) #define NUM2CHR(x) RB_NUM2CHR(x) #define CHR2FIX(x) RB_CHR2FIX(x) +#if SIZEOF_LONG < SIZEOF_VALUE +#define RB_ST2FIX(h) RB_LONG2FIX((long)((h) > 0 ? (h) & (unsigned long)-1 >> 2 : (h) | ~((unsigned long)-1 >> 2))) +#else #define RB_ST2FIX(h) RB_LONG2FIX((long)(h)) +#endif #define ST2FIX(h) RB_ST2FIX(h) #define RB_ALLOC_N(type,n) ((type*)ruby_xmalloc2((size_t)(n),sizeof(type))) -- cgit v1.2.3