diff --git a/vm_args.c b/vm_args.c index c1d829c019..7a2f8135da 100644 --- a/vm_args.c +++ b/vm_args.c @@ -392,7 +392,7 @@ args_setup_kw_parameters_lookup(const ID key, VALUE *ptr, const VALUE *const pas 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 args_setup_kw_parameters(rb_execution_context_t *const ec, const rb_iseq_t *const iseq, diff --git a/vm_insnhelper.c b/vm_insnhelper.c index 7480815d3a..1327050b2d 100644 --- a/vm_insnhelper.c +++ b/vm_insnhelper.c @@ -3026,7 +3026,7 @@ vm_check_keyword(lindex_t bits, lindex_t idx, const VALUE *ep) const VALUE kw_bits = *(ep - 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))) return Qfalse; }