From c02e4d4bbe2b36ebaa841cea31ed3b67b165529d Mon Sep 17 00:00:00 2001 From: Leandro Lucarella Date: Tue, 4 Oct 2005 02:11:54 +0000 Subject: [PATCH] Usa naif() como operator*. --- src/number.h | 12 +++++------- tests/number.cpp | 3 ++- 2 files changed, 7 insertions(+), 8 deletions(-) diff --git a/src/number.h b/src/number.h index 5b0b71e..57fb1b8 100644 --- a/src/number.h +++ b/src/number.h @@ -229,19 +229,17 @@ std::ostream& operator<< (std::ostream& os, const number< N, E >& n) template < typename N, typename E > number< N, E >& number< N, E >::operator*= (const number< N, E >& n) { - number < N, E > r_op = n; - normalize_length(n); - n.normalize_length(*this); - *this = divide_n_conquer(*this, n); + //number < N, E > r_op = n; + //normalize_length(n); + //n.normalize_length(*this); + *this = naif(*this, n); return *this; } template < typename N, typename E > number< N, E > operator* (const number< N, E >& n1, const number< N, E >& n2) { - number< N, E > tmp = n1; - tmp *= n2; - return tmp; + return naif(n1, n2); } template < typename N, typename E > diff --git a/tests/number.cpp b/tests/number.cpp index 75b97f0..44e56ab 100644 --- a/tests/number.cpp +++ b/tests/number.cpp @@ -8,10 +8,11 @@ int main() //unsigned buf[3] = { 0xffffffff, 0x1, 0 }; number<> nu(buf, 4); //number< unsigned > nu2(nu); - number<> nu2 = 1u; + number<> nu2 = 2u; std::cout << "nu = " << nu << "\n\n"; std::cout << "nu2 = " << nu2 << "\n\n"; std::cout << "nu + nu2 = " << nu + nu2 << "\n\n"; + std::cout << "nu * nu2 = " << nu * nu2 << "\n\n"; #endif #if 0 -- 2.43.0