mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
vm_args.c: fix KW_SPECIFIED_BITS_MAX
* vm_args.c (KW_SPECIFIED_BITS_MAX): subtracted 1bit for FIXNUM_FLAG. [ruby-core:84921] [Bug #14373] * vm_insnhelper.c (vm_check_keyword): unsigned for bit operation. git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@61945 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
350c2ac453
commit
12c0cc0172
2 changed files with 2 additions and 2 deletions
|
@ -392,7 +392,7 @@ args_setup_kw_parameters_lookup(const ID key, VALUE *ptr, const VALUE *const pas
|
||||||
return FALSE;
|
return FALSE;
|
||||||
}
|
}
|
||||||
|
|
||||||
#define KW_SPECIFIED_BITS_MAX 32 /* TODO: 32 -> Fixnum's max bits */
|
#define KW_SPECIFIED_BITS_MAX (32-1) /* TODO: 32 -> Fixnum's max bits */
|
||||||
|
|
||||||
static void
|
static void
|
||||||
args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq,
|
args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq,
|
||||||
|
|
|
@ -3026,7 +3026,7 @@ vm_check_keyword(lindex_t bits, lindex_t idx, const VALUE *ep)
|
||||||
const VALUE kw_bits = *(ep - bits);
|
const VALUE kw_bits = *(ep - bits);
|
||||||
|
|
||||||
if (FIXNUM_P(kw_bits)) {
|
if (FIXNUM_P(kw_bits)) {
|
||||||
int b = FIX2INT(kw_bits);
|
unsigned int b = (unsigned int)FIX2ULONG(kw_bits);
|
||||||
if ((idx < KW_SPECIFIED_BITS_MAX) && (b & (0x01 << idx)))
|
if ((idx < KW_SPECIFIED_BITS_MAX) && (b & (0x01 << idx)))
|
||||||
return Qfalse;
|
return Qfalse;
|
||||||
}
|
}
|
||||||
|
|
Loading…
Reference in a new issue