ruby-changes:71390
From: nagachika <ko1@a...>
Date: Sun, 13 Mar 2022 12:12:22 +0900 (JST)
Subject: [ruby-changes:71390] 9c2213f669 (ruby_3_0): merge revision(s) 6a6227e0168b059c3ed34c9f0ace2e5dc2364221: [Backport #18517]
https://git.ruby-lang.org/ruby.git/commit/?id=9c2213f669 From 9c2213f6695a16917dbe7b5a3a334116d6d8bbf6 Mon Sep 17 00:00:00 2001 From: nagachika <nagachika@r...> Date: Sun, 13 Mar 2022 11:49:15 +0900 Subject: merge revision(s) 6a6227e0168b059c3ed34c9f0ace2e5dc2364221: [Backport #18517] Shifting zero always results in zero [Bug #18517] --- numeric.c | 2 ++ 1 file changed, 2 insertions(+) --- numeric.c | 2 ++ version.h | 2 +- 2 files changed, 3 insertions(+), 1 deletion(-) diff --git a/numeric.c b/numeric.c index e4bb4817bb..691ab77042 100644 --- a/numeric.c +++ b/numeric.c @@ -4529,6 +4529,7 @@ rb_fix_lshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4529 long val, width; val = NUM2LONG(x); + if (!val) return (rb_to_int(y), INT2FIX(0)); if (!FIXNUM_P(y)) return rb_big_lshift(rb_int2big(val), y); width = FIX2LONG(y); @@ -4575,6 +4576,7 @@ rb_fix_rshift(VALUE x, VALUE y) https://github.com/ruby/ruby/blob/trunk/numeric.c#L4576 long i, val; val = FIX2LONG(x); + if (!val) return (rb_to_int(y), INT2FIX(0)); if (!FIXNUM_P(y)) return rb_big_rshift(rb_int2big(val), y); i = FIX2LONG(y); diff --git a/version.h b/version.h index 5de5de5fc7..9ada821db3 100644 --- a/version.h +++ b/version.h @@ -12,7 +12,7 @@ https://github.com/ruby/ruby/blob/trunk/version.h#L12 # define RUBY_VERSION_MINOR RUBY_API_VERSION_MINOR #define RUBY_VERSION_TEENY 4 #define RUBY_RELEASE_DATE RUBY_RELEASE_YEAR_STR"-"RUBY_RELEASE_MONTH_STR"-"RUBY_RELEASE_DAY_STR -#define RUBY_PATCHLEVEL 191 +#define RUBY_PATCHLEVEL 192 #define RUBY_RELEASE_YEAR 2022 #define RUBY_RELEASE_MONTH 3 -- cgit v1.2.1 -- ML: ruby-changes@q... Info: http://www.atdot.net/~ko1/quickml/