зеркало из https://github.com/github/ruby.git
Moved RHASH_LEV_MASK and turned into a macro
Get rid of "ISO C restricts enumerator values to range of 'int'" error.
This commit is contained in:
Родитель
e315f3a134
Коммит
13e84d5c0a
3
hash.c
3
hash.c
|
@ -1317,10 +1317,11 @@ iter_lev_in_ivar_set(VALUE hash, int lev)
|
|||
rb_ivar_set_internal(hash, rb_intern("hash_iter_lev"), INT2FIX(lev));
|
||||
}
|
||||
|
||||
#define RHASH_LEV_MASK ((VALUE)RHASH_LEV_MAX << RHASH_LEV_SHIFT)
|
||||
static int
|
||||
iter_lev_in_flags(VALUE hash)
|
||||
{
|
||||
unsigned int u = (unsigned int)(RBASIC(hash)->flags & (unsigned int)RHASH_LEV_MASK) >> RHASH_LEV_SHIFT;
|
||||
unsigned int u = (unsigned int)((RBASIC(hash)->flags >> RHASH_LEV_SHIFT) & RHASH_LEV_MAX);
|
||||
return (int)u;
|
||||
}
|
||||
|
||||
|
|
|
@ -827,8 +827,6 @@ enum ruby_rhash_flags {
|
|||
RHASH_TRANSIENT_FLAG = FL_USER12, /* FL 12 */
|
||||
#endif
|
||||
|
||||
RHASH_LEV_MASK = (FL_USER13 | FL_USER14 | FL_USER15 | /* FL 13..19 */
|
||||
FL_USER16 | FL_USER17 | FL_USER18 | FL_USER19),
|
||||
RHASH_LEV_SHIFT = (FL_USHIFT + 13),
|
||||
RHASH_LEV_MAX = 127, /* 7 bits */
|
||||
|
||||
|
|
Загрузка…
Ссылка в новой задаче