Added specialisations for __int64 and long long where these are missing.

[SVN r14558]
This commit is contained in:
John Maddock
2002-07-22 11:00:20 +00:00
parent 06034f2281
commit 3a70564582

View File

@@ -17,57 +17,121 @@
# include <limits> # include <limits>
#endif #endif
#if defined(BOOST_MSVC) && BOOST_MSVC <= 1200 && !defined(__SGI_STL_PORT) && !defined(_CPPLIB_VER) #if (defined(BOOST_HAS_LONG_LONG) && defined(BOOST_NO_LONG_LONG_NUMERIC_LIMITS)) \
// Add missing specializations for MSVC || (defined(BOOST_HAS_MS_INT64) && defined(BOOST_NO_MS_INT64_NUMERIC_LIMITS))
// Add missing specializations for numeric_limits:
#ifdef BOOST_HAS_MS_INT64
# define BOOST_LLT __int64
#else
# define BOOST_LLT long long
#endif
namespace std namespace std
{ {
class numeric_limits<__int64> : public _Num_int_base { template<>
class numeric_limits<BOOST_LLT>
{
public: public:
static __int64 (__cdecl min)() _THROW0()
{return (_I64_MIN); } BOOST_STATIC_CONSTANT(bool, is_specialized = true);
static __int64 (__cdecl max)() _THROW0() #ifdef BOOST_HAS_MS_INT64
{return (_I64_MAX); } static BOOST_LLT min(){ return 0x8000000000000000i64; }
static __int64 __cdecl epsilon() _THROW0() static BOOST_LLT max(){ return 0x7FFFFFFFFFFFFFFFi64; }
{return 0; } #elif defined(LLONG_MAX)
static __int64 __cdecl round_error() _THROW0() static BOOST_LLT min(){ return LLONG_MIN; }
{return 0; } static BOOST_LLT max(){ return LLONG_MAX; }
static __int64 __cdecl denorm_min() _THROW0() #elif defined(LONGLONG_MAX)
{return 0; } static BOOST_LLT min(){ return LONGLONG_MIN; }
static __int64 __cdecl infinity() _THROW0() static BOOST_LLT max(){ return LONGLONG_MAX; }
{return 0; } #else
static __int64 __cdecl quiet_NaN() _THROW0() static BOOST_LLT min(){ return 1LL << (sizeof(BOOST_LLT) * CHAR_BIT - 1); }
{return 0; } static BOOST_LLT max(){ return ~min(); }
static __int64 __cdecl signaling_NaN() _THROW0() #endif
{return 0; } BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
_STCONS(bool, is_signed, true); BOOST_STATIC_CONSTANT(bool, is_signed = true);
_STCONS(int, digits, CHAR_BIT * sizeof (__int64) - 1); BOOST_STATIC_CONSTANT(bool, is_integer = true);
_STCONS(int, digits10, (CHAR_BIT * sizeof (__int64) - 1) BOOST_STATIC_CONSTANT(bool, is_exact = true);
* 301L / 1000); BOOST_STATIC_CONSTANT(int, radix = 2);
static BOOST_LLT epsilon() throw() { return 0; };
static BOOST_LLT round_error() throw() { return 0; };
BOOST_STATIC_CONSTANT(int, min_exponent = 0);
BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
BOOST_STATIC_CONSTANT(int, max_exponent = 0);
BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
BOOST_STATIC_CONSTANT(bool, has_infinity = false);
BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_denorm = false);
BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
static BOOST_LLT infinity() throw() { return 0; };
static BOOST_LLT quiet_NaN() throw() { return 0; };
static BOOST_LLT signaling_NaN() throw() { return 0; };
static BOOST_LLT denorm_min() throw() { return 0; };
BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
BOOST_STATIC_CONSTANT(bool, is_bounded = false);
BOOST_STATIC_CONSTANT(bool, is_modulo = false);
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
}; };
class numeric_limits<unsigned __int64> : public _Num_int_base { template<>
class numeric_limits<unsigned BOOST_LLT>
{
public: public:
static unsigned __int64 (__cdecl min)() _THROW0()
{return 0; } BOOST_STATIC_CONSTANT(bool, is_specialized = true);
static unsigned __int64 (__cdecl max)() _THROW0() #ifdef BOOST_HAS_MS_INT64
{return (_UI64_MAX); } static unsigned BOOST_LLT min(){ return 0ui64; }
static unsigned __int64 __cdecl epsilon() _THROW0() static unsigned BOOST_LLT max(){ return 0xFFFFFFFFFFFFFFFFui64; }
{return 0; } #elif defined(ULLONG_MAX)
static unsigned __int64 __cdecl round_error() _THROW0() static unsigned BOOST_LLT min(){ return ULLONG_MIN; }
{return 0; } static unsigned BOOST_LLT max(){ return ULLONG_MAX; }
static unsigned __int64 __cdecl denorm_min() _THROW0() #elif defined(ULONGLONG_MAX)
{return 0; } static unsigned BOOST_LLT min(){ return ULONGLONG_MIN; }
static unsigned __int64 __cdecl infinity() _THROW0() static unsigned BOOST_LLT max(){ return ULONGLONG_MAX; }
{return 0; } #else
static unsigned __int64 __cdecl quiet_NaN() _THROW0() static unsigned BOOST_LLT min(){ return 0uLL; }
{return 0; } static unsigned BOOST_LLT max(){ return ~0uLL; }
static unsigned __int64 __cdecl signaling_NaN() _THROW0() #endif
{return 0; } BOOST_STATIC_CONSTANT(int, digits = sizeof(BOOST_LLT) * CHAR_BIT -1);
_STCONS(bool, is_signed, false); BOOST_STATIC_CONSTANT(int, digits10 = (CHAR_BIT * sizeof (BOOST_LLT) - 1) * 301L / 1000);
_STCONS(int, digits, CHAR_BIT * sizeof (unsigned __int64)); BOOST_STATIC_CONSTANT(bool, is_signed = false);
_STCONS(int, digits10, (CHAR_BIT * sizeof (unsigned __int64)) BOOST_STATIC_CONSTANT(bool, is_integer = true);
* 301L / 1000); BOOST_STATIC_CONSTANT(bool, is_exact = true);
BOOST_STATIC_CONSTANT(int, radix = 2);
static unsigned BOOST_LLT epsilon() throw() { return 0; };
static unsigned BOOST_LLT round_error() throw() { return 0; };
BOOST_STATIC_CONSTANT(int, min_exponent = 0);
BOOST_STATIC_CONSTANT(int, min_exponent10 = 0);
BOOST_STATIC_CONSTANT(int, max_exponent = 0);
BOOST_STATIC_CONSTANT(int, max_exponent10 = 0);
BOOST_STATIC_CONSTANT(bool, has_infinity = false);
BOOST_STATIC_CONSTANT(bool, has_quiet_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_signaling_NaN = false);
BOOST_STATIC_CONSTANT(bool, has_denorm = false);
BOOST_STATIC_CONSTANT(bool, has_denorm_loss = false);
static unsigned BOOST_LLT infinity() throw() { return 0; };
static unsigned BOOST_LLT quiet_NaN() throw() { return 0; };
static unsigned BOOST_LLT signaling_NaN() throw() { return 0; };
static unsigned BOOST_LLT denorm_min() throw() { return 0; };
BOOST_STATIC_CONSTANT(bool, is_iec559 = false);
BOOST_STATIC_CONSTANT(bool, is_bounded = false);
BOOST_STATIC_CONSTANT(bool, is_modulo = false);
BOOST_STATIC_CONSTANT(bool, traps = false);
BOOST_STATIC_CONSTANT(bool, tinyness_before = false);
BOOST_STATIC_CONSTANT(float_round_style, round_style = round_toward_zero);
}; };
} }
#endif #endif