From 74553109a50c92553b4095a34e7b65467ee9880f Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sun, 14 Jun 2009 18:45:36 +0000 Subject: [PATCH] fixed: (performance) in Big::LnSurrounding1() and Big::ExpSurrounding0() we can copy 'old_value = *this' only when 'testing' is true git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@160 e52654a7-88a9-db11-a3e9-0013d4bc506e --- ttmath/ttmathbig.h | 31 ++++++++++++++++++------------- 1 file changed, 18 insertions(+), 13 deletions(-) diff --git a/ttmath/ttmathbig.h b/ttmath/ttmathbig.h index e6f8b5a..422d563 100644 --- a/ttmath/ttmathbig.h +++ b/ttmath/ttmathbig.h @@ -1424,13 +1424,15 @@ public: // there shouldn't be a carry here Add( next_part ); - if( testing && old_value==*this ) - // we've added next few parts of the formula but the result - // is still the same then we break the loop - break; - else - old_value = *this; - + if( testing ) + { + if( old_value == *this ) + // we've added next few parts of the formula but the result + // is still the same then we break the loop + break; + else + old_value = *this; + } // we set the denominator and the numerator for a next part of the formula if( denominator_i.Add(one) ) @@ -1591,12 +1593,15 @@ public: // there shouldn't be a carry here Add(next_part); - if( testing && old_value == *this ) - // we've added next (step_test) parts of the formula but the result - // is still the same then we break the loop - break; - else - old_value = *this; + if( testing ) + { + if( old_value == *this ) + // we've added next (step_test) parts of the formula but the result + // is still the same then we break the loop + break; + else + old_value = *this; + } if( x1.Mul(x2) ) // if there is a carry here the result we return as good