summaryrefslogtreecommitdiff
path: root/gmpxx.h
diff options
context:
space:
mode:
authorMarc Glisse <marc.glisse@inria.fr>2012-02-16 21:41:39 +0100
committerMarc Glisse <marc.glisse@inria.fr>2012-02-16 21:41:39 +0100
commit6ccdf3596dbccb115d141114d96a9d28cdb10e18 (patch)
treec046f566a7a52dbf10d26bef16ba100f0d336fc6 /gmpxx.h
parent71e62c3340b9ffa636bb61e1a1e3c81334bcba3f (diff)
downloadgmp-6ccdf3596dbccb115d141114d96a9d28cdb10e18.tar.gz
Replace e=a*b-c*d with tmp=c*d, e=a*b, e-=tmp, which uses one less temporary.
Diffstat (limited to 'gmpxx.h')
-rw-r--r--gmpxx.h15
1 files changed, 9 insertions, 6 deletions
diff --git a/gmpxx.h b/gmpxx.h
index 0448d948e..31c6f1da9 100644
--- a/gmpxx.h
+++ b/gmpxx.h
@@ -2441,8 +2441,9 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ __gmp_expr<T, T> temp2(expr.val2);
+ expr.val1.eval(p);
+ Op::eval(p, p, temp2.__get_mp());
}
void eval(typename __gmp_resolve_expr<T>::ptr_type p,
mp_bitcnt_t prec) const
@@ -2474,8 +2475,9 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ __gmp_expr<T, T> temp1(expr.val1);
+ expr.val2.eval(p);
+ Op::eval(p, temp1.__get_mp(), p);
}
void eval(typename __gmp_resolve_expr<T>::ptr_type p,
mp_bitcnt_t prec) const
@@ -2507,8 +2509,9 @@ public:
: expr(val1, val2) { }
void eval(typename __gmp_resolve_expr<T>::ptr_type p) const
{
- __gmp_expr<T, T> temp1(expr.val1), temp2(expr.val2);
- Op::eval(p, temp1.__get_mp(), temp2.__get_mp());
+ __gmp_expr<T, T> temp2(expr.val2);
+ expr.val1.eval(p);
+ Op::eval(p, p, temp2.__get_mp());
}
void eval(typename __gmp_resolve_expr<T>::ptr_type p,
mp_bitcnt_t prec) const