diff options
author | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-27 00:53:12 +0900 |
---|---|---|
committer | Nobuyoshi Nakada <nobu@ruby-lang.org> | 2022-01-27 14:00:33 +0900 |
commit | 6a6227e0168b059c3ed34c9f0ace2e5dc2364221 (patch) | |
tree | 6bacde0ebb739044c9cd91dda0c27a9b848eadd1 /numeric.c | |
parent | 99d02caed3fb86a8bbe3ae6daddf2517e2f3f441 (diff) |
Shifting zero always results in zero [Bug #18517]
Notes
Notes: Merged: https://github.com/ruby/ruby/pull/5494
Diffstat (limited to 'numeric.c')
-rw-r--r-- | numeric.c | 2 |
1 files changed, 2 insertions, 0 deletions
@@ -5073,6 +5073,7 @@ rb_fix_lshift(VALUE x, VALUE y) 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); @@ -5127,6 +5128,7 @@ rb_fix_rshift(VALUE x, VALUE y) 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); |