added: macros TTMATH_ASSERT to: UInt::AddInt UInt::AddTwoInts UInt::SubInt UInt::SetBitInWord

fixed:   UInt::FindLeadingBitInWord(x) didn't correctly return result -1 when the x was 0
         the mistake made by Thomas Braby, it was not in the 0.8.2 release
changed: tests: we do not test for lahf/sahf instructions now (in 64bit code)
         we don't use these instructions



git-svn-id: svn://ttmath.org/publicrep/ttmath/trunk@97 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
2009-02-17 11:37:12 +00:00
parent 6da0386a2d
commit 5b24101a83
3 changed files with 25 additions and 75 deletions

View File

@@ -245,6 +245,8 @@ public:
register uint * p1 = table;
register uint * p2 = const_cast<uint*>(ss2.table);
// we don't have to use TTMATH_REFERENCE_ASSERT here
// this algorithm doesn't require it
#ifndef __GNUC__
@@ -354,6 +356,8 @@ public:
register uint * p1 = table;
register uint c;
TTMATH_ASSERT( index < value_size )
#ifndef __GNUC__
__asm
@@ -466,6 +470,8 @@ public:
register uint * p1 = table;
register uint c;
TTMATH_ASSERT( index < value_size - 1 )
#ifndef __GNUC__
__asm
{
@@ -566,6 +572,9 @@ public:
register uint * p1 = table;
register uint * p2 = const_cast<uint*>(ss2.table);
// we don't have to use TTMATH_REFERENCE_ASSERT here
// this algorithm doesn't require it
#ifndef __GNUC__
__asm
@@ -667,6 +676,8 @@ public:
register uint * p1 = table;
register uint c;
TTMATH_ASSERT( index < value_size )
#ifndef __GNUC__
__asm
{
@@ -1424,15 +1435,12 @@ public:
push eax
push edx
and edx,-1
bsr eax, x
mov edx,-1
bsr eax,x
cmovz eax,edx
mov result, eax
//
pop edx
//
pop eax
}
#endif
@@ -1441,11 +1449,10 @@ public:
#ifdef __GNUC__
__asm__ __volatile__(
"push %%edx \n"
"andl $-1,%%edx \n"
"bsrl %1, %0 \n"
"cmovz %%edx,%0 \n"
"pop %%edx \n"
"jnz 1f \n"
"movl $-1, %0 \n"
"1: \n"
: "=R" (result)
: "R" (x)
@@ -1507,6 +1514,8 @@ public:
*/
static uint SetBitInWord(uint value, uint bit)
{
TTMATH_ASSERT( bit < TTMATH_BITS_PER_UINT )
#ifndef __GNUC__
__asm
{

View File

@@ -825,14 +825,13 @@ namespace ttmath
#ifdef __GNUC__
__asm__ __volatile__(
"push %%rdx \n"
"andq $-1,%%rdx \n"
"bsrq %%rbx, %%rax \n"
"cmovz %%rdx,%%rax \n"
"pop %%rdx \n"
"bsrq %1, %0 \n"
"jnz 1f \n"
"movq $-1, %0 \n"
"1: \n"
: "=a" (result)
: "b" (x)
: "=R" (result)
: "R" (x)
: "cc" );
#endif