From 404727f3de51e31014906b2d4a85030614b7c6cb Mon Sep 17 00:00:00 2001 From: Tomasz Sowa Date: Sat, 7 Mar 2009 22:54:42 +0000 Subject: [PATCH] changed: small changes in: UInt:: RclMoveAllWords, UInt::RcrMoveAllWords, UInt::SetBitInWord(), UInt::FindLeadingBitInWord, UInt::SetBitInWord fixed: UInt::Div() didn't return a correct result when the divisor was equal 1 there was an error in UInt::DivInt() - when the divisor was 1 it returned zero and the carry was set this error was from the beginning of the TTMath library git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@103 e52654a7-88a9-db11-a3e9-0013d4bc506e --- ttmath/ttmathuint.h | 40 ++++++++++++++++++++-------------------- 1 file changed, 20 insertions(+), 20 deletions(-) diff --git a/ttmath/ttmathuint.h b/ttmath/ttmathuint.h index d507564..7642060 100644 --- a/ttmath/ttmathuint.h +++ b/ttmath/ttmathuint.h @@ -1207,15 +1207,16 @@ private: */ void RclMoveAllWords(uint & rest_bits, uint & last_c, uint bits, uint c) { - rest_bits = sint(bits % TTMATH_BITS_PER_UINT); - sint all_words = sint(bits / TTMATH_BITS_PER_UINT); + rest_bits = bits % TTMATH_BITS_PER_UINT; + uint all_words = bits / TTMATH_BITS_PER_UINT; uint mask = ( c ) ? TTMATH_UINT_MAX_VALUE : 0; - if( all_words >= sint(value_size) ) + if( all_words >= value_size ) { if( all_words == value_size && rest_bits == 0 ) last_c = table[0] & 1; + // else: last_c is default set to 0 // clearing for(uint i = 0 ; i= sint(value_size) ) + if( all_words >= value_size ) { if( all_words == value_size && rest_bits == 0 ) last_c = (table[value_size-1] & TTMATH_UINT_HIGHEST_BIT) ? 1 : 0; + // else: last_c is default set to 0 // clearing for(uint i = 0 ; i dividend(*this);