added: const char * UInt::LibTypeStr()

const char * Big::LibTypeStr()
         LibTypeCode UInt::LibType()
         LibTypeCode Big::LibType()
         returning a string/enum represents the currect type of the library
         we have following types:
             asm_vc_32   - with asm code designed for Microsoft Visual C++ (32 bits)
             asm_gcc_32  - with asm code designed for GCC (32 bits)
             asm_vc_64   - with asm for VC (64 bit)
             asm_gcc_64  - with asm for GCC (64 bit)
             no_asm_32   - pure C++ version (32 bit) - without any asm code
             no_asm_64   - pure C++ version (64 bit) - without any asm code
changed: another compilers than MS VC or GCC by default use no asm version (TTMATH_NOASM)



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@247 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Tomasz Sowa 2009-11-24 20:15:46 +00:00
parent 11b9f389b9
commit e083c5f889
7 changed files with 200 additions and 1 deletions

View File

@ -47,7 +47,19 @@ Version 0.9.0 prerelease (2009.11.24):
* added: UInt::Sqrt() - a new algorithm for calculating the square root
* added: to the parser: function frac() - returns a value without the integer part
(only fraction remains)
* added: Int::DivInt(int divisor, int * remainder)
* added: Int::DivInt(sint divisor, sint * remainder)
* added: const char * UInt::LibTypeStr()
const char * Big::LibTypeStr()
LibTypeCode UInt::LibType()
LibTypeCode Big::LibType()
returning a string/enum represents the currect type of the library
we have following types:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
* changed: Factorial() is using the Gamma() function now
* changed: Big::Div(ss2)
Big::Mod(ss2)
@ -70,6 +82,7 @@ Version 0.9.0 prerelease (2009.11.24):
base 16: 1.FFFFFFEA
* changed: in Big::ToString() some additional rounding (base_round) is now made only
when the value is not an integer
* changed: another compilers than MS VC or GCC by default use no asm version (TTMATH_NOASM)
* removed: Parser<>::SetFactorialMax() method
the factorial() is such a fast now that we don't need the method longer
* removed: ErrorCode::err_too_big_factorial

View File

@ -132,6 +132,32 @@ unsigned char info;
public:
/*!
returning the string represents the currect type of the library
we have following types:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
static const char * LibTypeStr()
{
return UInt<man>::LibTypeStr();
}
/*!
returning the currect type of the library
*/
static LibTypeCode LibType()
{
return UInt<man>::LibType();
}
/*!
this method moves all bits from mantissa into its left side
(suitably changes the exponent) or if the mantissa is zero

View File

@ -112,6 +112,15 @@ namespace ttmath
/*!
another compilers than MS VC or GCC by default use no asm version (TTMATH_NOASM)
*/
#if !defined _MSC_VER && !defined __GNUC__
#define TTMATH_NOASM
#endif
#ifdef TTMATH_PLATFORM32
/*!
@ -284,6 +293,26 @@ namespace ttmath
namespace ttmath
{
/*!
lib type codes:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
enum LibTypeCode
{
asm_vc_32 = 0,
asm_gcc_32,
asm_vc_64,
asm_gcc_64,
no_asm_32,
no_asm_64
};
/*!
error codes
*/

View File

@ -3373,6 +3373,8 @@ private:
uint Rcr2(uint bits, uint c);
public:
static const char * LibTypeStr();
static LibTypeCode LibType();
uint Add(const UInt<value_size> & ss2, uint c=0);
uint AddInt(uint value, uint index = 0);
uint AddTwoInts(uint x2, uint x1, uint index);

View File

@ -52,6 +52,49 @@
namespace ttmath
{
/*!
returning the string represents the currect type of the library
we have following types:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
template<uint value_size>
const char * UInt<value_size>::LibTypeStr()
{
#ifdef TTMATH_PLATFORM32
static const char info[] = "no_asm_32";
#endif
#ifdef TTMATH_PLATFORM64
static const char info[] = "no_asm_64";
#endif
return info;
}
/*!
returning the currect type of the library
*/
template<uint value_size>
LibTypeCode UInt<value_size>::LibType()
{
#ifdef TTMATH_PLATFORM32
LibTypeCode info = no_asm_32;
#endif
#ifdef TTMATH_PLATFORM64
LibTypeCode info = no_asm_64;
#endif
return info;
}
/*!
this method adds two words together
returns carry

View File

@ -60,6 +60,50 @@
namespace ttmath
{
/*!
returning the string represents the currect type of the library
we have following types:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
template<uint value_size>
const char * UInt<value_size>::LibTypeStr()
{
#ifndef __GNUC__
static const char info[] = "asm_vc_32";
#endif
#ifdef __GNUC__
static const char info[] = "asm_gcc_32";
#endif
return info;
}
/*!
returning the currect type of the library
*/
template<uint value_size>
LibTypeCode UInt<value_size>::LibType()
{
#ifndef __GNUC__
LibTypeCode info = asm_vc_32;
#endif
#ifdef __GNUC__
LibTypeCode info = asm_gcc_32;
#endif
return info;
}
/*!
*
* basic mathematic functions

View File

@ -79,6 +79,48 @@ namespace ttmath
#endif
/*!
returning the string represents the currect type of the library
we have following types:
asm_vc_32 - with asm code designed for Microsoft Visual C++ (32 bits)
asm_gcc_32 - with asm code designed for GCC (32 bits)
asm_vc_64 - with asm for VC (64 bit)
asm_gcc_64 - with asm for GCC (64 bit)
no_asm_32 - pure C++ version (32 bit) - without any asm code
no_asm_64 - pure C++ version (64 bit) - without any asm code
*/
template<uint value_size>
const char * UInt<value_size>::LibTypeStr()
{
#ifdef _MSC_VER
static const char info[] = "asm_vc_64";
#endif
#ifdef __GNUC__
static const char info[] = "asm_gcc_64";
#endif
return info;
}
/*!
returning the currect type of the library
*/
template<uint value_size>
LibTypeCode UInt<value_size>::LibType()
{
#ifdef _MSC_VER
LibTypeCode info = asm_vc_64;
#endif
#ifdef __GNUC__
LibTypeCode info = asm_gcc_64;
#endif
return info;
}
/*!
*