[poincare] GreatCommonDivisor: avoid copy when possible

This commit is contained in:
Émilie Feral
2018-08-27 17:30:43 +02:00
parent b9e073107c
commit 1853e35d39

View File

@@ -69,7 +69,7 @@ Expression GreatCommonDivisor::shallowReduce(Context& context, Preferences::Angl
}
}
if (c1.type() == ExpressionNode::Type::Rational) {
Rational r1 = static_cast<Rational>(c1);
Rational r1 = static_cast<Rational&>(c1);
if (!r1.integerDenominator().isOne()) {
return Undefined();
}
@@ -77,8 +77,8 @@ Expression GreatCommonDivisor::shallowReduce(Context& context, Preferences::Angl
if (c0.type() != ExpressionNode::Type::Rational || c1.type() != ExpressionNode::Type::Rational) {
return *this;
}
Rational r0 = static_cast<Rational>(c0);
Rational r1 = static_cast<Rational>(c1);
Rational r0 = static_cast<Rational&>(c0);
Rational r1 = static_cast<Rational&>(c1);
Integer a = r0.signedIntegerNumerator();
Integer b = r1.signedIntegerNumerator();