Project

General

Profile

« Previous | Next » 

Revision 3483e6da

Added by shyouhei (Shyouhei Urabe) over 6 years ago

hash.c: +(-1) is a wrong idea

Before this changeset RHASH_ARRAY_SIZE_DEC() was expaneded to include
an expression like RHASH_ARRAY_SIZE+(-1). RHASH_ARRAY_SIZE is by
definition unsigned int. -1 is signed, of course. Adding a signed
and an unsigned value requires the "usual arithmetic conversions" (cf:
ISO/IEC 9899:1990 section 6.2.1.5). -1 is converted to 0xFFFF by that.

This patch prevents that conversion.

git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@65632 b2dd03c8-39d4-4d8f-98ff-823fe69b080e