diff --git a/COPYRIGHT b/COPYRIGHT index e2af1c2..0e1660a 100644 --- a/COPYRIGHT +++ b/COPYRIGHT @@ -1,4 +1,4 @@ -Copyright (c) 2006-2008, Tomasz Sowa +Copyright (c) 2006-2009, Tomasz Sowa All rights reserved. Redistribution and use in source and binary forms, with or without diff --git a/ttmath/ttmathbig.h b/ttmath/ttmathbig.h index c3a727e..f319f52 100644 --- a/ttmath/ttmathbig.h +++ b/ttmath/ttmathbig.h @@ -1630,17 +1630,39 @@ public: uint man_len_min = (man < another_man)? man : another_man; uint i; + uint c = 0; for( i = 0 ; i another_man )' and 'if( man < another_man )' and there'll be no such a situation here + #pragma warning( disable: 4307 ) + + if( man > another_man ) + { + uint man_diff = (man - another_man) * TTMATH_BITS_PER_UINT; + c += exponent.SubInt(man_diff, 0); + } + else + if( man < another_man ) + { + uint man_diff = (another_man - man) * TTMATH_BITS_PER_UINT; + c += exponent.AddInt(man_diff, 0); + } + + #pragma warning( default: 4307 ) + + + // mantissa doesn't have to be standardized (either the highest bit is set or all bits are equal zero) + CorrectZero(); + + return (c == 0 )? 0 : 1; }