mirror of
https://github.com/ruby/ruby.git
synced 2022-11-09 12:17:21 -05:00
rational.c: optimize rational + integer.
* rational.c (rb_rational_plus): optimize rational + integer. Author: Tadashi Saito <tad.a.digger@gmail.com> git-svn-id: svn+ssh://ci.ruby-lang.org/ruby/trunk@56705 b2dd03c8-39d4-4d8f-98ff-823fe69b080e
This commit is contained in:
parent
70f5ad7c41
commit
dae15fa0d4
1 changed files with 3 additions and 3 deletions
|
@ -735,9 +735,9 @@ rb_rational_plus(VALUE self, VALUE other)
|
|||
{
|
||||
get_dat1(self);
|
||||
|
||||
return f_addsub(self,
|
||||
dat->num, dat->den,
|
||||
other, ONE, '+');
|
||||
return f_rational_new_no_reduce2(CLASS_OF(self),
|
||||
rb_int_plus(dat->num, rb_int_mul(other, dat->den)),
|
||||
dat->den);
|
||||
}
|
||||
}
|
||||
else if (RB_TYPE_P(other, T_FLOAT)) {
|
||||
|
|
Loading…
Add table
Reference in a new issue