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

@@ -40,68 +40,12 @@
#include <ttmath/ttmath.h>
#include "uinttest.h"
//#include <windows.h>
const char uint_tests_file[] = "tests.uint32";
bool test_lahf()
{
#ifdef TTMATH_PLATFORM64
#ifndef __GNUC__
#error "another compiler than GCC is currently not supported in 64bit mode"
#endif
std::cout << "Processor 64bit: checking LAHF and SAHF instructions....";
unsigned long int is_lahf;
__asm__ __volatile__ (
"push %%rax \n"
"push %%rcx \n"
"push %%rdx \n"
"mov $0x80000001, %%rax \n"
"CPUID \n"
"test $1, %%rcx \n"
"setnz %%al \n"
"movzx %%al, %%rbx \n"
"pop %%rdx \n"
"pop %%rcx \n"
"pop %%rax \n"
: "=b" (is_lahf)
:
: "cc"
);
if( is_lahf )
{
std::cout << "ok" << std::endl;
return true;
}
std::cout << "fail" << std::endl;
return false;
#endif
// 32bit platform
return true;
}
void test_uint()
{
UIntTest test;
@@ -116,8 +60,6 @@ int main()
{
using namespace ttmath;
if( !test_lahf() )
return 1;
test_uint();