Skip to content

Commit

Permalink
Removed fix_shift_get_width()
Browse files Browse the repository at this point in the history
Fixnum is usually big enough for shift width.
  • Loading branch information
matz committed Nov 22, 2016
1 parent 740bf09 commit 8112295
Showing 1 changed file with 2 additions and 13 deletions.
15 changes: 2 additions & 13 deletions src/numeric.c
Original file line number Diff line number Diff line change
Expand Up @@ -921,15 +921,6 @@ rshift(mrb_int val, mrb_int width)
return mrb_fixnum_value(val >> width);
}

static inline void
fix_shift_get_width(mrb_state *mrb, mrb_int *width)
{
mrb_value y;

mrb_get_args(mrb, "o", &y);
*width = mrb_fixnum(bit_coerce(mrb, y));
}

/* 15.2.8.3.12 */
/*
* call-seq:
Expand All @@ -943,8 +934,7 @@ fix_lshift(mrb_state *mrb, mrb_value x)
{
mrb_int width, val;

fix_shift_get_width(mrb, &width);

mrb_get_args(mrb, "i", &width);
if (width == 0) {
return x;
}
Expand All @@ -968,8 +958,7 @@ fix_rshift(mrb_state *mrb, mrb_value x)
{
mrb_int width, val;

fix_shift_get_width(mrb, &width);

mrb_get_args(mrb, "i", &width);
if (width == 0) {
return x;
}
Expand Down

0 comments on commit 8112295

Please sign in to comment.