added: Big::operator++()
Big::operator++(int) Big::operator--() Big::operator--(int) Big::AddOne() Big::SubOne() changed: Big::SetOne() a little faster now git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@310 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
ae61b302a8
commit
b6fe168e3c
|
@ -1,4 +1,4 @@
|
||||||
Version 0.9.2 prerelease (2010.09.15):
|
Version 0.9.2 prerelease (2010.09.18):
|
||||||
* fixed: Big::Add() sometimes incorrectly rounded the last bit from its mantissa
|
* fixed: Big::Add() sometimes incorrectly rounded the last bit from its mantissa
|
||||||
* fixed: Big::BigAnd() Big::BigOr() Big::BigXor() should have set NaN
|
* fixed: Big::BigAnd() Big::BigOr() Big::BigXor() should have set NaN
|
||||||
when the argument was negative (they only returned 2)
|
when the argument was negative (they only returned 2)
|
||||||
|
@ -18,7 +18,11 @@ Version 0.9.2 prerelease (2010.09.15):
|
||||||
Big::operator|=()
|
Big::operator|=()
|
||||||
Big::operator^()
|
Big::operator^()
|
||||||
Big::operator^=()
|
Big::operator^=()
|
||||||
for Big<> we do not define bitwise neg
|
for Big<> we do not define bitwise neg
|
||||||
|
Big::operator++()
|
||||||
|
Big::operator++(int)
|
||||||
|
Big::operator--()
|
||||||
|
Big::operator--(int)
|
||||||
* added: macro TTMATH_DONT_USE_WCHAR
|
* added: macro TTMATH_DONT_USE_WCHAR
|
||||||
if defined then the library does not use wide characters
|
if defined then the library does not use wide characters
|
||||||
(wchar_t, std::wstring, ...) this is a workaround for some compilers
|
(wchar_t, std::wstring, ...) this is a workaround for some compilers
|
||||||
|
|
|
@ -270,7 +270,12 @@ public:
|
||||||
*/
|
*/
|
||||||
void SetOne()
|
void SetOne()
|
||||||
{
|
{
|
||||||
FromUInt(1);
|
info = 0;
|
||||||
|
mantissa.SetZero();
|
||||||
|
mantissa.table[man-1] = TTMATH_UINT_HIGHEST_BIT;
|
||||||
|
exponent = -sint(man * TTMATH_BITS_PER_UINT - 1);
|
||||||
|
|
||||||
|
// don't have to Standardize() - the last bit is set
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
@ -279,7 +284,7 @@ public:
|
||||||
*/
|
*/
|
||||||
void Set05()
|
void Set05()
|
||||||
{
|
{
|
||||||
FromUInt(1);
|
SetOne();
|
||||||
exponent.SubOne();
|
exponent.SubOne();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -693,7 +698,7 @@ public:
|
||||||
}
|
}
|
||||||
else
|
else
|
||||||
if( IsZero() )
|
if( IsZero() )
|
||||||
SetZero();
|
SetZero(); // !! is nedeed here?
|
||||||
else
|
else
|
||||||
SetOne();
|
SetOne();
|
||||||
}
|
}
|
||||||
|
@ -792,6 +797,33 @@ private:
|
||||||
*
|
*
|
||||||
*/
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
this method adds one to the existing value
|
||||||
|
*/
|
||||||
|
uint AddOne()
|
||||||
|
{
|
||||||
|
Big<exp, man> one;
|
||||||
|
|
||||||
|
one.SetOne();
|
||||||
|
|
||||||
|
return Add(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
this method subtracts one from the existing value
|
||||||
|
*/
|
||||||
|
uint SubOne()
|
||||||
|
{
|
||||||
|
Big<exp, man> one;
|
||||||
|
|
||||||
|
one.SetOne();
|
||||||
|
|
||||||
|
return Sub(one);
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
private:
|
private:
|
||||||
|
|
||||||
|
|
||||||
|
@ -4966,6 +4998,48 @@ public:
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Prefix operator e.g ++variable
|
||||||
|
*/
|
||||||
|
Big<exp,man> & operator++()
|
||||||
|
{
|
||||||
|
AddOne();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
/*!
|
||||||
|
Postfix operator e.g variable++
|
||||||
|
*/
|
||||||
|
Big<exp,man> operator++(int)
|
||||||
|
{
|
||||||
|
Big<exp,man> temp( *this );
|
||||||
|
|
||||||
|
AddOne();
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Big<exp,man> & operator--()
|
||||||
|
{
|
||||||
|
SubOne();
|
||||||
|
|
||||||
|
return *this;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
Big<exp,man> operator--(int)
|
||||||
|
{
|
||||||
|
Big<exp,man> temp( *this );
|
||||||
|
|
||||||
|
SubOne();
|
||||||
|
|
||||||
|
return temp;
|
||||||
|
}
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
/*!
|
/*!
|
||||||
*
|
*
|
||||||
|
|
Loading…
Reference in New Issue