mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
Reduce NUM2INT invocations.
git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@42796 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
bc3d736f43
commit
1df73dd9ad
1 changed files with 3 additions and 3 deletions
|
@ -18,7 +18,7 @@ big2str_generic(VALUE x, VALUE vbase)
|
|||
int base = NUM2INT(vbase);
|
||||
if (base < 2 || 36 < base)
|
||||
rb_raise(rb_eArgError, "invalid radix %d", base);
|
||||
return rb_big2str_generic(big(x), NUM2INT(vbase));
|
||||
return rb_big2str_generic(big(x), base);
|
||||
}
|
||||
|
||||
#define POW2_P(x) (((x)&((x)-1))==0)
|
||||
|
@ -29,7 +29,7 @@ big2str_poweroftwo(VALUE x, VALUE vbase)
|
|||
int base = NUM2INT(vbase);
|
||||
if (base < 2 || 36 < base || !POW2_P(base))
|
||||
rb_raise(rb_eArgError, "invalid radix %d", base);
|
||||
return rb_big2str_poweroftwo(big(x), NUM2INT(vbase));
|
||||
return rb_big2str_poweroftwo(big(x), base);
|
||||
}
|
||||
|
||||
#if defined(HAVE_LIBGMP) && defined(HAVE_GMP_H)
|
||||
|
@ -39,7 +39,7 @@ big2str_gmp(VALUE x, VALUE vbase)
|
|||
int base = NUM2INT(vbase);
|
||||
if (base < 2 || 36 < base)
|
||||
rb_raise(rb_eArgError, "invalid radix %d", base);
|
||||
return rb_big2str_gmp(big(x), NUM2INT(vbase));
|
||||
return rb_big2str_gmp(big(x), base);
|
||||
}
|
||||
#else
|
||||
#define big2str_gmp rb_f_notimplement
|
||||
|
|
Loading…
Add table
Reference in a new issue