fixed: Int::DivInt() should take parameters as 'sint' and not 'int'
this has impact on 64 bit platforms fixed: some warnings from Visual C++ (64 bit) git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@245 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
parent
bac79e0bfa
commit
11b9f389b9
|
@ -46,10 +46,12 @@
|
||||||
*/
|
*/
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning( disable: 4127 )
|
|
||||||
//warning C4127: conditional expression is constant
|
//warning C4127: conditional expression is constant
|
||||||
#pragma warning( disable: 4702 )
|
#pragma warning( disable: 4127 )
|
||||||
//warning C4702: unreachable code
|
//warning C4702: unreachable code
|
||||||
|
#pragma warning( disable: 4702 )
|
||||||
|
//warning C4800: forcing value to bool 'true' or 'false' (performance warning)
|
||||||
|
#pragma warning( disable: 4800 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
|
|
||||||
|
@ -2822,10 +2824,12 @@ namespace ttmath
|
||||||
|
|
||||||
|
|
||||||
#ifdef _MSC_VER
|
#ifdef _MSC_VER
|
||||||
#pragma warning( default: 4127 )
|
|
||||||
//warning C4127: conditional expression is constant
|
//warning C4127: conditional expression is constant
|
||||||
#pragma warning( disable: 4702 )
|
#pragma warning( default: 4127 )
|
||||||
//warning C4702: unreachable code
|
//warning C4702: unreachable code
|
||||||
|
#pragma warning( default: 4702 )
|
||||||
|
//warning C4800: forcing value to bool 'true' or 'false' (performance warning)
|
||||||
|
#pragma warning( default: 4800 )
|
||||||
#endif
|
#endif
|
||||||
|
|
||||||
#endif
|
#endif
|
||||||
|
|
|
@ -3401,17 +3401,17 @@ private:
|
||||||
Int<exp+1> & new_exp,
|
Int<exp+1> & new_exp,
|
||||||
uint bits) const
|
uint bits) const
|
||||||
{
|
{
|
||||||
int move; // how many times move the mantissa
|
sint move; // how many times move the mantissa
|
||||||
UInt<man+1> man_temp(mantissa); // man+1 for moving
|
UInt<man+1> man_temp(mantissa); // man+1 for moving
|
||||||
new_exp = exponent;
|
new_exp = exponent;
|
||||||
new_exp.DivInt((int)bits, move);
|
new_exp.DivInt((sint)bits, move);
|
||||||
|
|
||||||
if( move != 0 )
|
if( move != 0 )
|
||||||
{
|
{
|
||||||
// we're moving the man_temp to left-hand side
|
// we're moving the man_temp to left-hand side
|
||||||
if( move < 0 )
|
if( move < 0 )
|
||||||
{
|
{
|
||||||
move = bits + move;
|
move = sint(bits) + move;
|
||||||
new_exp.SubOne(); // when move is < than 0 then new_exp is < 0 too
|
new_exp.SubOne(); // when move is < than 0 then new_exp is < 0 too
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -482,7 +482,7 @@ public:
|
||||||
|
|
||||||
in other words: this(old) = ss2 * this(new)(result) + remainder
|
in other words: this(old) = ss2 * this(new)(result) + remainder
|
||||||
*/
|
*/
|
||||||
uint DivInt(int ss2, int * remainder = 0)
|
uint DivInt(sint ss2, sint * remainder = 0)
|
||||||
{
|
{
|
||||||
bool ss1_is_sign, ss2_is_sign;
|
bool ss1_is_sign, ss2_is_sign;
|
||||||
|
|
||||||
|
@ -512,16 +512,16 @@ public:
|
||||||
if( remainder )
|
if( remainder )
|
||||||
{
|
{
|
||||||
if( ss1_is_sign )
|
if( ss1_is_sign )
|
||||||
*remainder = -int(rem);
|
*remainder = -sint(rem);
|
||||||
else
|
else
|
||||||
*remainder = int(rem);
|
*remainder = sint(rem);
|
||||||
}
|
}
|
||||||
|
|
||||||
return c;
|
return c;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
||||||
uint DivInt(int ss2, int & remainder)
|
uint DivInt(sint ss2, sint & remainder)
|
||||||
{
|
{
|
||||||
return DivInt(ss2, &remainder);
|
return DivInt(ss2, &remainder);
|
||||||
}
|
}
|
||||||
|
|
|
@ -356,10 +356,10 @@ namespace ttmath
|
||||||
default: true
|
default: true
|
||||||
|
|
||||||
e.g.
|
e.g.
|
||||||
Conv c;
|
Conv c;
|
||||||
c.base_round = false;
|
c.base_round = false;
|
||||||
Big<1, 1> a = "0.1"; // decimal input
|
Big<1, 1> a = "0.1"; // decimal input
|
||||||
std::cout << a.ToString(c) << std::endl; // the result is: 0.099999999
|
std::cout << a.ToString(c) << std::endl; // the result is: 0.099999999
|
||||||
*/
|
*/
|
||||||
bool base_round;
|
bool base_round;
|
||||||
|
|
||||||
|
|
Loading…
Reference in New Issue