- minor changes for ASSERT macros

- some more "unification" of 32 and 64 bits in typedefs
- use of 'char' instead of 'unsigned char', as I may hope that 'char' usually is set to 'unsigned' in most development environments

git-svn-id: svn://ttmath.org/publicrep/ttmath/branches/chk@133 e52654a7-88a9-db11-a3e9-0013d4bc506e
This commit is contained in:
Christian Kaiser
2009-05-06 15:47:15 +00:00
parent c91bd24e98
commit d7b67e4d47
3 changed files with 892 additions and 901 deletions

View File

@@ -44,7 +44,7 @@ namespace ttmath
typedef std::wostream tostrm_t; typedef std::wostream tostrm_t;
typedef std::wistream tistrm_t; typedef std::wistream tistrm_t;
#else #else
typedef unsigned char tchar_t; typedef char tchar_t;
typedef std::string tstr_t; typedef std::string tstr_t;
typedef std::ostringstream tostrstrm_t; typedef std::ostringstream tostrstrm_t;
typedef std::ostream tostrm_t; typedef std::ostream tostrm_t;
@@ -58,7 +58,7 @@ namespace ttmath
#endif #endif
#define TTMATH_TEXT(quote) __TEXT(quote) #define TTMATH_TEXT(quote) __TEXT(quote)
#else #else
typedef unsigned char tchar_t; typedef char tchar_t;
typedef std::string tstr_t; typedef std::string tstr_t;
typedef std::ostringstream tostrstrm_t; typedef std::ostringstream tostrstrm_t;
typedef std::ostream tostrm_t; typedef std::ostream tostrm_t;

View File

@@ -132,21 +132,16 @@ namespace ttmath
*/ */
typedef unsigned long long int ulint; typedef unsigned long long int ulint;
/*!
how many bits there are in the uint type
*/
#define TTMATH_BITS_PER_UINT 32u
/*! /*!
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)
*/ */
#define TTMATH_UINT_HIGHEST_BIT 2147483648u #define TTMATH_UINT_HIGHEST_BIT 0x80000000ul
/*! /*!
the max value of the unsigned 32bit word (2^32 - 1) the max value of the unsigned 32bit word (2^32 - 1)
(all bits equal one) (all bits equal one)
*/ */
#define TTMATH_UINT_MAX_VALUE 4294967295u #define TTMATH_UINT_MAX_VALUE 0xfffffffful
/*! /*!
the number of words (32bit words on 32bit platform) the number of words (32bit words on 32bit platform)
@@ -176,11 +171,6 @@ namespace ttmath
*/ */
//typedef unsigned long long int ulint; //typedef unsigned long long int ulint;
/*!
how many bits there are in the uint type
*/
#define TTMATH_BITS_PER_UINT 64ul
/*! /*!
the mask for the highest bit in the unsigned 64bit word (2^63) the mask for the highest bit in the unsigned 64bit word (2^63)
*/ */
@@ -200,6 +190,8 @@ namespace ttmath
#define TTMATH_BUILTIN_VARIABLES_SIZE 128ul #define TTMATH_BUILTIN_VARIABLES_SIZE 128ul
#endif #endif
#define TTMATH_BITS_PER_UINT (sizeof(uint)*8)
} }
@@ -412,10 +404,10 @@ namespace ttmath
#if defined(__FILE__) && defined(__LINE__) #if defined(__FILE__) && defined(__LINE__)
#define TTMATH_REFERENCE_ASSERT(expression) \ #define TTMATH_REFERENCE_ASSERT(expression) \
if( &(expression) == this ) throw ttmath::ReferenceError(__FILE__, __LINE__); if( &(expression) == this ) throw ttmath::ReferenceError(TTMATH_TEXT(__FILE__), __LINE__);
#define TTMATH_ASSERT(expression) \ #define TTMATH_ASSERT(expression) \
if( !(expression) ) throw ttmath::RuntimeError(__FILE__, __LINE__); if( !(expression) ) throw ttmath::RuntimeError(TTMATH_TEXT(__FILE__), __LINE__);
#else #else

View File

@@ -41,7 +41,6 @@
#ifndef TTMATH_NOASM #ifndef TTMATH_NOASM
#pragma message("ASM code included")
#ifdef TTMATH_PLATFORM64 #ifdef TTMATH_PLATFORM64
/*! /*!