diff options
author | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-22 08:52:11 +0000 |
---|---|---|
committer | usa <usa@b2dd03c8-39d4-4d8f-98ff-823fe69b080e> | 2017-12-22 08:52:11 +0000 |
commit | 52220154a8310d0140829daa1de665003bb11dec (patch) | |
tree | 88573f478ccd41c18c42c1b7900c9e02b6400d96 /hash.c | |
parent | 072ed558d5b27f484ba4fb65f5e778ffad54d951 (diff) | |
download | ruby-52220154a8310d0140829daa1de665003bb11dec.tar.gz |
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
Diffstat (limited to 'hash.c')
-rw-r--r-- | hash.c | 10 |
1 files changed, 9 insertions, 1 deletions
@@ -193,8 +193,16 @@ any_hash(VALUE a, st_index_t (*other_func)(VALUE)) hnum = other_func(a); } out: +#if SIZEOF_LONG < SIZEOF_ST_INDEX_T + if (hnum > 0) + hnum &= (unsigned long)-1 >> 2; + else + hnum |= ~((unsigned long)-1 >> 2); +#else hnum <<= 1; - return (long)RSHIFT(hnum, 1); + hnum = RSHIFT(hnum, 1); +#endif + return (long)hnum; } static st_index_t |