current chk version - too many changes on both sides for now ;-(

git-svn-id: svn://ttmath.org/publicrep/ttmath/branches/chk@150 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Christian Kaiser
2009-05-19 10:50:41 +00:00
9 changed files with 12491 additions and 12487 deletions

View File

@@ -1,4 +1,4 @@
Version 0.8.5 (2009.05.11): Version 0.8.5 prerelease (2009.05.15):
* fixed: Big::Mod(x) didn't correctly return a carry * fixed: Big::Mod(x) didn't correctly return a carry
and the result was sometimes very big (even greater than x) and the result was sometimes very big (even greater than x)
* fixed: global function Mod(x) didn't set an ErrorCode object * fixed: global function Mod(x) didn't set an ErrorCode object
@@ -11,6 +11,25 @@ Version 0.8.5 (2009.05.11):
the same is to Cos() function the same is to Cos() function
* changed: PrepareSin(x) is using Big::Mod() now when reducing 2PI period * changed: PrepareSin(x) is using Big::Mod() now when reducing 2PI period
should be a little accurate especially on a very big 'x' should be a little accurate especially on a very big 'x'
* changed: uint Mul(const UInt<value_size> & ss2, uint algorithm = 100)
void MulBig(const UInt<value_size> & ss2, UInt<value_size*2> & result, uint algorithm = 100)
those methods by default use MulFastest() and MulFastestBig()
* changed: changed a little Mul2Big() to cooperate with Mul3Big()
* added: uint UInt::Mul3(const UInt<value_size> & ss2)
void UInt::Mul3Big(const UInt<value_size> & ss2, UInt<value_size*2> & result)
a new multiplication algorithm: Karatsuba multiplication,
on a vector UInt<100> with all items different from zero this algorithm is faster
about 3 times than Mul2Big(), and on a vector UInt<1000> with all items different from
zero this algorithm is faster more than 5 times than Mul2Big()
(measured on 32bit platform with GCC 4.3.3 with -O3 and -DTTMATH_RELEASE)
* added: uint MulFastest(const UInt<value_size> & ss2)
void MulFastestBig(const UInt<value_size> & ss2, UInt<value_size*2> & result)
those methods are trying to select the fastest multiplication algorithm
* added: uint AddVector(const uint * ss1, const uint * ss2, uint ss1_size, uint ss2_size, uint * result)
uint SubVector(const uint * ss1, const uint * ss2, uint ss1_size, uint ss2_size, uint * result)
three forms: asm x86, asm x86_64, no-asm
those methods are used by the Karatsuba multiplication algorithm
Version 0.8.4 (2009.05.08): Version 0.8.4 (2009.05.08):
* fixed: UInt::DivInt() didn't check whether the divisor is zero * fixed: UInt::DivInt() didn't check whether the divisor is zero

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -64,7 +64,7 @@
*/ */
#define TTMATH_MAJOR_VER 0 #define TTMATH_MAJOR_VER 0
#define TTMATH_MINOR_VER 8 #define TTMATH_MINOR_VER 8
#define TTMATH_REVISION_VER 5 #define TTMATH_REVISION_VER 4
#define TTMATH_PRERELEASE_VER 1 #define TTMATH_PRERELEASE_VER 1
@@ -120,6 +120,7 @@ namespace ttmath
typedef unsigned int uint; typedef unsigned int uint;
typedef signed int sint; typedef signed int sint;
/*! /*!
this type is twice bigger than uint this type is twice bigger than uint
(64bit on a 32bit platforms) (64bit on a 32bit platforms)
@@ -128,11 +129,8 @@ namespace ttmath
but it is defined in C99 and in upcoming C++0x /3.9.1 (2)/ and many compilers support it but it is defined in C99 and in upcoming C++0x /3.9.1 (2)/ and many compilers support it
this type is used in UInt::MulTwoWords and UInt::DivTwoWords when macro TTMATH_NOASM is defined this type is used in UInt::MulTwoWords and UInt::DivTwoWords when macro TTMATH_NOASM is defined
but only on a 32bit platform
*/ */
#ifdef TTMATH_NOASM typedef unsigned long long int ulint;
typedef unsigned long long int ulint;
#endif
/*! /*!
the mask for the highest bit in the unsigned 32bit word (2^31) the mask for the highest bit in the unsigned 32bit word (2^31)

File diff suppressed because it is too large Load Diff

File diff suppressed because it is too large Load Diff

View File

@@ -158,7 +158,7 @@ namespace ttmath
table[1] = 30 + 2; table[1] = 30 + 2;
table[2] = 5; table[2] = 5;
of course if there was a carry from table[2] it would be returned of course if there was a carry from table[3] it would be returned
*/ */
template<uint value_size> template<uint value_size>
uint UInt<value_size>::AddInt(uint value, uint index) uint UInt<value_size>::AddInt(uint value, uint index)
@@ -374,7 +374,7 @@ namespace ttmath
table[1] = 30 - 2; table[1] = 30 - 2;
table[2] = 5; table[2] = 5;
of course if there was a carry from table[2] it would be returned of course if there was a carry from table[3] it would be returned
*/ */
template<uint value_size> template<uint value_size>
uint UInt<value_size>::SubInt(uint value, uint index) uint UInt<value_size>::SubInt(uint value, uint index)
@@ -695,7 +695,7 @@ namespace ttmath
/* /*
this method returns the number of the highest set bit in one 64-bit word this method returns the number of the highest set bit in one 32-bit word
if the 'x' is zero this method returns '-1' if the 'x' is zero this method returns '-1'
***this method is created only on a 64bit platform*** ***this method is created only on a 64bit platform***
@@ -800,17 +800,18 @@ namespace ttmath
/*! /*!
multiplication: result_high:result_low = a * b multiplication: result2:result1 = a * b
result_high - higher word of the result result2 - higher word
result_low - lower word of the result result1 - lower word of the result
this methos never returns a carry this methos never returns a carry
this method is used in the second version of the multiplication algorithms
***this method is created only on a 64bit platform*** ***this method is created only on a 64bit platform***
it is an auxiliary method for version two of the multiplication algorithm
*/ */
template<uint value_size> template<uint value_size>
void UInt<value_size>::MulTwoWords(uint a, uint b, uint * result_high, uint * result_low) void UInt<value_size>::MulTwoWords(uint a, uint b, uint * result2, uint * result1)
{ {
/* /*
we must use these temporary variables in order to inform the compilator we must use these temporary variables in order to inform the compilator
@@ -843,8 +844,8 @@ namespace ttmath
#endif #endif
*result_low = result1_; *result1 = result1_;
*result_high = result2_; *result2 = result2_;
} }

View File

@@ -114,9 +114,9 @@ loop1:
mov r9, 0 ; set to 0 -> cy still set! mov r9, 0 ; set to 0 -> cy still set!
dec rdx dec rdx
jnz loop1 jnz loop1
jc return_1 ; most of the times, there will be NO carry (I hope)
done: done:
jc return_1 ; most of the times, there will be NO carry (I hope)
xor rax, rax xor rax, rax
ret ret
@@ -184,9 +184,9 @@ loop1:
mov r9, 1 mov r9, 1
dec rdx dec rdx
jnz loop1 jnz loop1
done:
jc return_1 ; most of the times, there will be NO carry (I hope) jc return_1 ; most of the times, there will be NO carry (I hope)
done:
xor rax, rax xor rax, rax
ret ret