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
@ -735,9 +735,9 @@ rb_rational_plus(VALUE self, VALUE other)
|
|||||||
{
|
{
|
||||||
get_dat1(self);
|
get_dat1(self);
|
||||||
|
|
||||||
return f_addsub(self,
|
return f_rational_new_no_reduce2(CLASS_OF(self),
|
||||||
dat->num, dat->den,
|
rb_int_plus(dat->num, rb_int_mul(other, dat->den)),
|
||||||
other, ONE, '+');
|
dat->den);
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
else if (RB_TYPE_P(other, T_FLOAT)) {
|
else if (RB_TYPE_P(other, T_FLOAT)) {
|
||||||
|
Loading…
x
Reference in New Issue
Block a user