diff --git a/CHANGELOG b/CHANGELOG index ff5523d..1cbd8f4 100644 --- a/CHANGELOG +++ b/CHANGELOG @@ -1,4 +1,4 @@ -Version 0.9.0 prerelease (2009.09.13): +Version 0.9.0 prerelease (2009.09.20): * fixed: Big::operator>>(std::istream&, Big<> &) didn't recognize values in scientific mode (with 'e' character) * added: support for wide characters (wchar_t, std::wstring) @@ -25,6 +25,9 @@ Version 0.9.0 prerelease (2009.09.13): Big::SetInfoBit(unsigned char) Big::IsInfoBit(unsigned char) some methods for manipulating the info flags + * added: macro: TTMATH_BITS(min_bits) + which returns the number of machine words + capable to hold min_bits bits * changed: Factorial() is using the Gamma() function now * changed: Big::Div(ss2) Big::Mod(ss2) diff --git a/ttmath/ttmath.h b/ttmath/ttmath.h index 9d4e4c2..57b07a0 100644 --- a/ttmath/ttmath.h +++ b/ttmath/ttmath.h @@ -46,10 +46,13 @@ */ #ifdef _MSC_VER -//warning C4127: conditional expression is constant #pragma warning( disable: 4127 ) +//warning C4127: conditional expression is constant +#pragma warning( disable: 4702 ) +//warning C4702: unreachable code #endif + #include "ttmathbig.h" #include "ttmathobjects.h" @@ -2788,6 +2791,8 @@ namespace ttmath #ifdef _MSC_VER #pragma warning( default: 4127 ) //warning C4127: conditional expression is constant +#pragma warning( disable: 4702 ) +//warning C4702: unreachable code #endif #endif diff --git a/ttmath/ttmathtypes.h b/ttmath/ttmathtypes.h index 0b73d33..8bbb464 100644 --- a/ttmath/ttmathtypes.h +++ b/ttmath/ttmathtypes.h @@ -157,6 +157,13 @@ namespace ttmath */ #define TTMATH_BUILTIN_VARIABLES_SIZE 256u + /*! + this macro returns the number of machine words + capable to hold min_bits bits + e.g. TTMATH_BITS(128) returns 4 + */ + #define TTMATH_BITS(min_bits) ((min_bits-1)/32 + 1) + #else /*! @@ -203,6 +210,13 @@ namespace ttmath */ #define TTMATH_BUILTIN_VARIABLES_SIZE 128ul + /*! + this macro returns the number of machine words + capable to hold min_bits bits + e.g. TTMATH_BITS(128) returns 2 + */ + #define TTMATH_BITS(min_bits) ((min_bits-1)/64 + 1) + #endif } @@ -279,6 +293,7 @@ namespace ttmath + namespace ttmath { diff --git a/ttmath/ttmathuint.h b/ttmath/ttmathuint.h index e6a3b9e..6aee6a3 100644 --- a/ttmath/ttmathuint.h +++ b/ttmath/ttmathuint.h @@ -2594,6 +2594,18 @@ public: */ UInt() { + // when macro TTMATH_DEBUG_LOG is defined + // we set special values to the table + // in order to be everywhere the same value of the UInt object + #ifdef TTMATH_DEBUG_LOG + #ifdef TTMATH_PLATFORM32 + for(uint i=0 ; i