From 648de47400b2d972eb42fcd3b738e5771e17ec2b Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Thu, 23 Sep 2010 19:25:26 +0000 Subject: [PATCH] fixed: Int::ToUInt(unsigned int & result) wrong carry was returned git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@318 e52654a7-88a9-db11-a3e9-0013d4bc506e --- ttmath/ttmathint.h | 9 ++------- ttmath/ttmathuint.h | 6 ------ 2 files changed, 2 insertions(+), 13 deletions(-) diff --git a/ttmath/ttmathint.h b/ttmath/ttmathint.h index 0b3fc96..abc9c28 100644 --- a/ttmath/ttmathint.h +++ b/ttmath/ttmathint.h @@ -1256,14 +1256,12 @@ public: */ uint ToUInt(unsigned int & result) const { - // !! need testing - uint c = UInt::ToUInt(result); - if( c ) + if( c || IsSign() ) return 1; - return (int(result) < 0) ? 1 : 0; + return 0; } @@ -1274,7 +1272,6 @@ public: */ uint ToInt(unsigned int & result) const { - // !! need testing return ToUInt(result); } @@ -1286,8 +1283,6 @@ public: */ uint ToInt(int & result) const { - // !! need testing - uint first = UInt::table[0]; result = int(first); diff --git a/ttmath/ttmathuint.h b/ttmath/ttmathuint.h index 812dff5..30fa349 100644 --- a/ttmath/ttmathuint.h +++ b/ttmath/ttmathuint.h @@ -3151,8 +3151,6 @@ public: */ uint ToUInt(unsigned int & result) const { - // !! need testing - result = (unsigned int)table[0]; if( (table[0] >> 32) != 0 ) @@ -3173,8 +3171,6 @@ public: */ uint ToInt(unsigned int & result) const { - // !! need testing - return ToUInt(result); } @@ -3186,8 +3182,6 @@ public: */ uint ToInt(int & result) const { - // !! need testing - unsigned int temp; uint c = ToUInt(temp);