Some fixes from trunk:
fixed: UInt::SetBitInWord(uint & value, uint bit) set 1 if the bit was equal 1 (should be set 2) this affected only no-asm parts - when macro TTMATH_NOASM was defined fixed: UInt<value_size>::MulInt(uint ss2) there was a buffer overflow when value_size was equal 1 fixed: UInt::AddVector() and UInt::SubVector() didn't want to compile when macro TTMATH_NOASM was defined fixed: Big::operator>> didn't correctly recognize values in scientific mode (with 'e' character) fixed: Int::FromString(const tt_string & s, uint b = 10) didn't use 'b' (always was '10') git-svn-id: svn://ttmath.org/publicrep/ttmath/branches/0.8.x@204 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
b80f73f16b
commit
5ef27bdbd0
13
CHANGELOG
13
CHANGELOG
|
@ -1,3 +1,16 @@
|
|||
Version 0.8.6 prerelease (2009.10.07):
|
||||
* fixed: UInt::SetBitInWord(uint & value, uint bit) set 1 if the bit was
|
||||
equal 1 (should be set 2)
|
||||
this affected only no-asm parts - when macro TTMATH_NOASM was defined
|
||||
* fixed: UInt<value_size>::MulInt(uint ss2)
|
||||
there was a buffer overflow when value_size was equal 1
|
||||
* fixed: UInt::AddVector() and UInt::SubVector() didn't want to compile
|
||||
when macro TTMATH_NOASM was defined
|
||||
* fixed: Big::operator>> didn't correctly recognize values in scientific mode (with 'e' character)
|
||||
* fixed: Int::FromString(const tt_string & s, uint b = 10)
|
||||
didn't use 'b' (always was '10')
|
||||
|
||||
|
||||
Version 0.8.5 (2009.06.16):
|
||||
* fixed: Big::Mod(x) didn't correctly return a carry
|
||||
and the result was sometimes very big (even greater than x)
|
||||
|
|
|
@ -4160,9 +4160,11 @@ public:
|
|||
{
|
||||
std::string ss;
|
||||
|
||||
// 'char' for operator>>
|
||||
unsigned char z;
|
||||
// char for operator>>
|
||||
char z, old_z;
|
||||
bool was_comma = false;
|
||||
bool was_e = false;
|
||||
|
||||
|
||||
// operator>> omits white characters if they're set for ommiting
|
||||
s >> z;
|
||||
|
@ -4172,25 +4174,44 @@ public:
|
|||
ss += z;
|
||||
s >> z; // we're reading a next character (white characters can be ommited)
|
||||
}
|
||||
|
||||
old_z = 0;
|
||||
|
||||
// we're reading only digits (base=10) and only one comma operator
|
||||
for( ; s.good() ; z=s.get() )
|
||||
for( ; s.good() ; z=static_cast<char>(s.get()) )
|
||||
{
|
||||
if( z == TTMATH_COMMA_CHARACTER_1 ||
|
||||
( z == TTMATH_COMMA_CHARACTER_2 && TTMATH_COMMA_CHARACTER_2 != 0 ) )
|
||||
{
|
||||
if( was_comma )
|
||||
// second comma operator
|
||||
if( was_comma || was_e )
|
||||
// second comma operator or comma operator after 'e' character
|
||||
break;
|
||||
|
||||
was_comma = true;
|
||||
}
|
||||
else
|
||||
if( z == 'e' || z == 'E' )
|
||||
{
|
||||
if( was_e )
|
||||
// second 'e' character
|
||||
break;
|
||||
|
||||
was_e = true;
|
||||
}
|
||||
else
|
||||
if( z == '+' || z == '-' )
|
||||
{
|
||||
if( old_z != 'e' && old_z != 'E' )
|
||||
// '+' or '-' is allowed only after 'e' character
|
||||
break;
|
||||
}
|
||||
else
|
||||
if( UInt<man>::CharToDigit(z, 10) < 0 )
|
||||
break;
|
||||
|
||||
|
||||
ss += z;
|
||||
ss += z;
|
||||
old_z = z;
|
||||
}
|
||||
|
||||
// we're leaving the last read character
|
||||
|
|
|
@ -963,7 +963,7 @@ public:
|
|||
*/
|
||||
uint FromString(const std::string & s, uint b = 10)
|
||||
{
|
||||
return FromString( s.c_str() );
|
||||
return FromString( s.c_str(), b );
|
||||
}
|
||||
|
||||
|
||||
|
|
|
@ -64,8 +64,8 @@
|
|||
*/
|
||||
#define TTMATH_MAJOR_VER 0
|
||||
#define TTMATH_MINOR_VER 8
|
||||
#define TTMATH_REVISION_VER 5
|
||||
#define TTMATH_PRERELEASE_VER 0
|
||||
#define TTMATH_REVISION_VER 6
|
||||
#define TTMATH_PRERELEASE_VER 1
|
||||
|
||||
|
||||
/*!
|
||||
|
|
|
@ -768,8 +768,7 @@ public:
|
|||
{
|
||||
MulTwoWords(u.table[x1], ss2, &r2, &r1 );
|
||||
|
||||
|
||||
if( x1 <= value_size - 2 )
|
||||
if( value_size>1 && x1<=value_size-2 )
|
||||
{
|
||||
if( AddTwoInts(r2,r1,x1) )
|
||||
return 1;
|
||||
|
|
|
@ -224,7 +224,7 @@ namespace ttmath
|
|||
for( ; i<ss1_size ; ++i)
|
||||
c = AddTwoWords(ss1[i], 0, c, &result[i]);
|
||||
|
||||
TTMATH_LOG("UInt::AddVector")
|
||||
//TTMATH_LOG("UInt::AddVector")
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -351,7 +351,7 @@ namespace ttmath
|
|||
for( ; i<ss1_size ; ++i)
|
||||
c = SubTwoWords(ss1[i], 0, c, &result[i]);
|
||||
|
||||
TTMATH_LOG("UInt::SubVector")
|
||||
//TTMATH_LOG("UInt::SubVector")
|
||||
|
||||
return c;
|
||||
}
|
||||
|
@ -553,7 +553,7 @@ namespace ttmath
|
|||
|
||||
uint mask = 1;
|
||||
|
||||
if( bit > 1 )
|
||||
if( bit > 0 )
|
||||
mask = mask << bit;
|
||||
|
||||
uint last = value & mask;
|
||||
|
|
Loading…
Reference in New Issue