Commit 72e4bfd9 by Jason Merrill

This commit was generated by cvs2svn to compensate for changes in r22177,

which included commits to RCS files with non-trunk default branches.

From-SVN: r22178
parent 38fcba26
...@@ -34,17 +34,22 @@ enum float_round_style { ...@@ -34,17 +34,22 @@ enum float_round_style {
round_toward_infinity = 2, round_toward_infinity = 2,
round_toward_neg_infinity = 3 round_toward_neg_infinity = 3
}; };
enum float_denorm_style {
denorm_indeterminate = -1,
denorm_absent = 0,
denorm_present = 1
};
// Base class for all specializations of numeric_limits. // Base class for all specializations of numeric_limits.
template <class Number> template <class __number>
class __numeric_limits_base { class _Numeric_limits_base {
public: public:
static const bool is_specialized = false; static const bool is_specialized = false;
static Number min() __STL_NOTHROW { return Number(); } static __number min() __STL_NOTHROW { return __number(); }
static Number max() __STL_NOTHROW { return Number(); } static __number max() __STL_NOTHROW { return __number(); }
static const int digits = 0; static const int digits = 0;
static const int digits10 = 0; static const int digits10 = 0;
...@@ -55,8 +60,8 @@ public: ...@@ -55,8 +60,8 @@ public:
static const int radix = 0; static const int radix = 0;
static Number epsilon() __STL_NOTHROW { return Number(); } static __number epsilon() __STL_NOTHROW { return __number(); }
static Number round_error() __STL_NOTHROW { return Number(); } static __number round_error() __STL_NOTHROW { return __number(); }
static const int min_exponent = 0; static const int min_exponent = 0;
static const int min_exponent10 = 0; static const int min_exponent10 = 0;
...@@ -66,13 +71,13 @@ public: ...@@ -66,13 +71,13 @@ public:
static const bool has_infinity = false; static const bool has_infinity = false;
static const bool has_quiet_NaN = false; static const bool has_quiet_NaN = false;
static const bool has_signaling_NaN = false; static const bool has_signaling_NaN = false;
static const bool has_denorm = false; static const float_denorm_style has_denorm = denorm_absent;
static const bool has_denorm_loss = false; static const bool has_denorm_loss = false;
static Number infinity() __STL_NOTHROW { return Number(); } static __number infinity() __STL_NOTHROW { return __number(); }
static Number quiet_NaN() __STL_NOTHROW { return Number(); } static __number quiet_NaN() __STL_NOTHROW { return __number(); }
static Number signaling_NaN() __STL_NOTHROW { return Number(); } static __number signaling_NaN() __STL_NOTHROW { return __number(); }
static Number denorm_min() __STL_NOTHROW { return Number(); } static __number denorm_min() __STL_NOTHROW { return __number(); }
static const bool is_iec559 = false; static const bool is_iec559 = false;
static const bool is_bounded = false; static const bool is_bounded = false;
...@@ -84,8 +89,8 @@ public: ...@@ -84,8 +89,8 @@ public:
}; };
#define __declare_numeric_base_member(__type, __mem) \ #define __declare_numeric_base_member(__type, __mem) \
template <class Number> \ template <class __number> \
const __type __numeric_limits_base<Number>:: __mem const __type _Numeric_limits_base<__number>:: __mem
__declare_numeric_base_member(bool, is_specialized); __declare_numeric_base_member(bool, is_specialized);
__declare_numeric_base_member(int, digits); __declare_numeric_base_member(int, digits);
...@@ -101,7 +106,7 @@ __declare_numeric_base_member(int, max_exponent10); ...@@ -101,7 +106,7 @@ __declare_numeric_base_member(int, max_exponent10);
__declare_numeric_base_member(bool, has_infinity); __declare_numeric_base_member(bool, has_infinity);
__declare_numeric_base_member(bool, has_quiet_NaN); __declare_numeric_base_member(bool, has_quiet_NaN);
__declare_numeric_base_member(bool, has_signaling_NaN); __declare_numeric_base_member(bool, has_signaling_NaN);
__declare_numeric_base_member(bool, has_denorm); __declare_numeric_base_member(float_denorm_style, has_denorm);
__declare_numeric_base_member(bool, has_denorm_loss); __declare_numeric_base_member(bool, has_denorm_loss);
__declare_numeric_base_member(bool, is_iec559); __declare_numeric_base_member(bool, is_iec559);
__declare_numeric_base_member(bool, is_bounded); __declare_numeric_base_member(bool, is_bounded);
...@@ -114,24 +119,25 @@ __declare_numeric_base_member(float_round_style, round_style); ...@@ -114,24 +119,25 @@ __declare_numeric_base_member(float_round_style, round_style);
// Base class for integers. // Base class for integers.
template <class __Int, template <class _Int,
__Int IMin, _Int __imin,
__Int IMax, _Int __imax,
int IDigits = -1> int __idigits = -1>
class __integer_limits : public __numeric_limits_base<__Int> class _Integer_limits : public _Numeric_limits_base<_Int>
{ {
public: public:
static const bool is_specialized = true; static const bool is_specialized = true;
static __Int min() __STL_NOTHROW { return IMin; } static _Int min() __STL_NOTHROW { return __imin; }
static __Int max() __STL_NOTHROW { return IMax; } static _Int max() __STL_NOTHROW { return __imax; }
static const int digits = static const int digits =
(IDigits < 0) ? sizeof(__Int) * CHAR_BIT - (IMin == 0 ? 0 : 1) : IDigits; (__idigits < 0) ? sizeof(_Int) * CHAR_BIT - (__imin == 0 ? 0 : 1)
: __idigits;
static const int digits10 = (digits * 301) / 1000; static const int digits10 = (digits * 301) / 1000;
// log 2 = 0.301029995664... // log 2 = 0.301029995664...
static const bool is_signed = IMin != 0; static const bool is_signed = __imin != 0;
static const bool is_integer = true; static const bool is_integer = true;
static const bool is_exact = true; static const bool is_exact = true;
static const int radix = 2; static const int radix = 2;
...@@ -142,8 +148,8 @@ public: ...@@ -142,8 +148,8 @@ public:
}; };
#define __declare_integer_limits_member(__type, __mem) \ #define __declare_integer_limits_member(__type, __mem) \
template <class __Int, __Int IMin, __Int IMax, int IDigits> \ template <class _Int, _Int __imin, _Int __imax, int __idigits> \
const __type __integer_limits<__Int, IMin, IMax, IDigits>:: __mem const __type _Integer_limits<_Int, __imin, __imax, __idigits>:: __mem
__declare_integer_limits_member(bool, is_specialized); __declare_integer_limits_member(bool, is_specialized);
__declare_integer_limits_member(int, digits); __declare_integer_limits_member(int, digits);
...@@ -158,56 +164,59 @@ __declare_integer_limits_member(bool, is_modulo); ...@@ -158,56 +164,59 @@ __declare_integer_limits_member(bool, is_modulo);
#undef __declare_integer_limits_member #undef __declare_integer_limits_member
// Base class for floating-point numbers. // Base class for floating-point numbers.
template <class Number, template <class __number,
int FDigits, int FDigits10, int __Digits, int __Digits10,
int FMinExp, int FMaxExp, int __MinExp, int __MaxExp,
int FMinExp10, int FMaxExp10, int __MinExp10, int __MaxExp10,
unsigned int FInfinityWord, unsigned int __InfinityWord,
unsigned int FQNaNWord, unsigned int FSNaNWord, unsigned int __QNaNWord, unsigned int __SNaNWord,
bool FIsIEC559, bool __IsIEC559,
float_round_style FRoundStyle> float_round_style __RoundStyle>
class __floating_limits : public __numeric_limits_base<Number> class _Floating_limits : public _Numeric_limits_base<__number>
{ {
public: public:
static const bool is_specialized = true; static const bool is_specialized = true;
static const int digits = FDigits; static const int digits = __Digits;
static const int digits10 = FDigits10; static const int digits10 = __Digits10;
static const bool is_signed = true; static const bool is_signed = true;
static const int radix = 2; static const int radix = 2;
static const int min_exponent = FMinExp; static const int min_exponent = __MinExp;
static const int max_exponent = FMaxExp; static const int max_exponent = __MaxExp;
static const int min_exponent10 = FMinExp10; static const int min_exponent10 = __MinExp10;
static const int max_exponent10 = FMaxExp10; static const int max_exponent10 = __MaxExp10;
static const bool has_infinity = true; static const bool has_infinity = true;
static const bool has_quiet_NaN = true; static const bool has_quiet_NaN = true;
static const bool has_signaling_NaN = true; static const bool has_signaling_NaN = true;
static const bool has_denorm = false; static const float_denorm_style has_denorm = denorm_indeterminate;
static const bool has_denorm_loss = false; static const bool has_denorm_loss = false;
static Number infinity() __STL_NOTHROW { static __number infinity() __STL_NOTHROW {
static unsigned int inf[sizeof(Number) / sizeof(int)] = { FInfinityWord }; static unsigned int _S_inf[sizeof(__number) / sizeof(int)] =
return *reinterpret_cast<Number*>(&inf); { __InfinityWord };
return *reinterpret_cast<__number*>(&_S_inf);
} }
static Number quiet_NaN() __STL_NOTHROW { static __number quiet_NaN() __STL_NOTHROW {
static unsigned int nan[sizeof(Number) / sizeof(int)] = { FQNaNWord }; static unsigned int _S_nan[sizeof(__number) / sizeof(int)] =
return *reinterpret_cast<Number*>(&nan); { __QNaNWord };
return *reinterpret_cast<__number*>(&_S_nan);
} }
static Number signaling_NaN() __STL_NOTHROW { static __number signaling_NaN() __STL_NOTHROW {
static unsigned int nan[sizeof(Number) / sizeof(int)] = { FSNaNWord }; static unsigned int _S_nan[sizeof(__number) / sizeof(int)] =
return *reinterpret_cast<Number*>(&nan); { __SNaNWord };
return *reinterpret_cast<__number*>(&_S_nan);
} }
static const bool is_iec559 = FIsIEC559; static const bool is_iec559 = __IsIEC559;
static const bool is_bounded = true; static const bool is_bounded = true;
static const bool traps = true; static const bool traps = true;
static const bool tinyness_before = false; static const bool tinyness_before = false;
static const float_round_style round_style = FRoundStyle; static const float_round_style round_style = __RoundStyle;
}; };
#define __declare_float_limits_member(__type, __mem) \ #define __declare_float_limits_member(__type, __mem) \
...@@ -215,9 +224,9 @@ template <class __Num, int __Dig, int __Dig10, \ ...@@ -215,9 +224,9 @@ template <class __Num, int __Dig, int __Dig10, \
int __MnX, int __MxX, int __MnX10, int __MxX10, \ int __MnX, int __MxX, int __MnX10, int __MxX10, \
unsigned int __Inf, unsigned int __QNaN, unsigned int __SNaN, \ unsigned int __Inf, unsigned int __QNaN, unsigned int __SNaN, \
bool __IsIEEE, float_round_style __Sty> \ bool __IsIEEE, float_round_style __Sty> \
const __type __floating_limits<__Num, __Dig, __Dig10, \ const __type _Floating_limits<__Num, __Dig, __Dig10, \
__MnX, __MxX, __MnX10, __MxX10, \ __MnX, __MxX, __MnX10, __MxX10, \
__Inf, __QNaN, __SNaN,__IsIEEE, __Sty>:: __mem __Inf, __QNaN, __SNaN,__IsIEEE, __Sty>:: __mem
__declare_float_limits_member(bool, is_specialized); __declare_float_limits_member(bool, is_specialized);
__declare_float_limits_member(int, digits); __declare_float_limits_member(int, digits);
...@@ -231,7 +240,7 @@ __declare_float_limits_member(int, max_exponent10); ...@@ -231,7 +240,7 @@ __declare_float_limits_member(int, max_exponent10);
__declare_float_limits_member(bool, has_infinity); __declare_float_limits_member(bool, has_infinity);
__declare_float_limits_member(bool, has_quiet_NaN); __declare_float_limits_member(bool, has_quiet_NaN);
__declare_float_limits_member(bool, has_signaling_NaN); __declare_float_limits_member(bool, has_signaling_NaN);
__declare_float_limits_member(bool, has_denorm); __declare_float_limits_member(float_denorm_style, has_denorm);
__declare_float_limits_member(bool, has_denorm_loss); __declare_float_limits_member(bool, has_denorm_loss);
__declare_float_limits_member(bool, is_iec559); __declare_float_limits_member(bool, is_iec559);
__declare_float_limits_member(bool, is_bounded); __declare_float_limits_member(bool, is_bounded);
...@@ -246,102 +255,102 @@ __declare_float_limits_member(float_round_style, round_style); ...@@ -246,102 +255,102 @@ __declare_float_limits_member(float_round_style, round_style);
// The unspecialized class. // The unspecialized class.
template<class T> template<class T>
class numeric_limits : public __numeric_limits_base<T> {}; class numeric_limits : public _Numeric_limits_base<T> {};
// Specializations for all built-in integral types. // Specializations for all built-in integral types.
#ifndef __STL_NEED_BOOL #ifndef __STL_NO_BOOL
template<> template<>
class numeric_limits<bool> class numeric_limits<bool>
: public __integer_limits<bool, false, true, 0> : public _Integer_limits<bool, false, true, 0>
{}; {};
#endif /* __STL_NEED_BOOL */ #endif /* __STL_NO_BOOL */
template<> template<>
class numeric_limits<char> class numeric_limits<char>
: public __integer_limits<char, CHAR_MIN, CHAR_MAX> : public _Integer_limits<char, CHAR_MIN, CHAR_MAX>
{}; {};
template<> template<>
class numeric_limits<signed char> class numeric_limits<signed char>
: public __integer_limits<signed char, SCHAR_MIN, SCHAR_MAX> : public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX>
{}; {};
template<> template<>
class numeric_limits<unsigned char> class numeric_limits<unsigned char>
: public __integer_limits<unsigned char, 0, UCHAR_MAX> : public _Integer_limits<unsigned char, 0, UCHAR_MAX>
{}; {};
#ifdef _WCHAR_T_IS_KEYWORD #ifdef __STL_HAS_WCHAR_T
template<> template<>
class numeric_limits<wchar_t> class numeric_limits<wchar_t>
: public __integer_limits<wchar_t, INT_MIN, INT_MAX> : public _Integer_limits<wchar_t, INT_MIN, INT_MAX>
{}; {};
#endif #endif
template<> template<>
class numeric_limits<short> class numeric_limits<short>
: public __integer_limits<short, SHRT_MIN, SHRT_MAX> : public _Integer_limits<short, SHRT_MIN, SHRT_MAX>
{}; {};
template<> template<>
class numeric_limits<unsigned short> class numeric_limits<unsigned short>
: public __integer_limits<unsigned short, 0, USHRT_MAX> : public _Integer_limits<unsigned short, 0, USHRT_MAX>
{}; {};
template<> template<>
class numeric_limits<int> class numeric_limits<int>
: public __integer_limits<int, INT_MIN, INT_MAX> : public _Integer_limits<int, INT_MIN, INT_MAX>
{}; {};
template<> template<>
class numeric_limits<unsigned int> class numeric_limits<unsigned int>
: public __integer_limits<unsigned int, 0, UINT_MAX> : public _Integer_limits<unsigned int, 0, UINT_MAX>
{}; {};
template<> template<>
class numeric_limits<long> class numeric_limits<long>
: public __integer_limits<long, LONG_MIN, LONG_MAX> : public _Integer_limits<long, LONG_MIN, LONG_MAX>
{}; {};
template<> template<>
class numeric_limits<unsigned long> class numeric_limits<unsigned long>
: public __integer_limits<unsigned long, 0, ULONG_MAX> : public _Integer_limits<unsigned long, 0, ULONG_MAX>
{}; {};
#if defined(_LONGLONG) && _SGIAPI #ifdef __STL_LONG_LONG
template<> template<>
class numeric_limits<long long> class numeric_limits<long long>
: public __integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX> : public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
{}; {};
template<> template<>
class numeric_limits<unsigned long long> class numeric_limits<unsigned long long>
: public __integer_limits<unsigned long long, 0, ULONGLONG_MAX> : public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
{}; {};
#endif /* _LONGLONG && _SGIAPI */ #endif /* __STL_LONG_LONG */
// Specializations for all built-in floating-point type. // Specializations for all built-in floating-point type.
template<> class numeric_limits<float> template<> class numeric_limits<float>
: public __floating_limits<float, : public _Floating_limits<float,
FLT_MANT_DIG, // Binary digits of precision FLT_MANT_DIG, // Binary digits of precision
FLT_DIG, // Decimal digits of precision FLT_DIG, // Decimal digits of precision
FLT_MIN_EXP, // Minimum exponent FLT_MIN_EXP, // Minimum exponent
FLT_MAX_EXP, // Maximum exponent FLT_MAX_EXP, // Maximum exponent
FLT_MIN_10_EXP, // Minimum base 10 exponent FLT_MIN_10_EXP, // Minimum base 10 exponent
FLT_MAX_10_EXP, // Maximum base 10 exponent FLT_MAX_10_EXP, // Maximum base 10 exponent
0x7f800000u, // First word of +infinity 0x7f800000u, // First word of +infinity
0x7f810000u, // First word of quiet NaN 0x7f810000u, // First word of quiet NaN
0x7fc10000u, // First word of signaling NaN 0x7fc10000u, // First word of signaling NaN
true, // conforms to iec559 true, // conforms to iec559
round_to_nearest> round_to_nearest>
{ {
public: public:
static float min() __STL_NOTHROW { return FLT_MIN; } static float min() __STL_NOTHROW { return FLT_MIN; }
...@@ -352,18 +361,18 @@ public: ...@@ -352,18 +361,18 @@ public:
}; };
template<> class numeric_limits<double> template<> class numeric_limits<double>
: public __floating_limits<double, : public _Floating_limits<double,
DBL_MANT_DIG, // Binary digits of precision DBL_MANT_DIG, // Binary digits of precision
DBL_DIG, // Decimal digits of precision DBL_DIG, // Decimal digits of precision
DBL_MIN_EXP, // Minimum exponent DBL_MIN_EXP, // Minimum exponent
DBL_MAX_EXP, // Maximum exponent DBL_MAX_EXP, // Maximum exponent
DBL_MIN_10_EXP, // Minimum base 10 exponent DBL_MIN_10_EXP, // Minimum base 10 exponent
DBL_MAX_10_EXP, // Maximum base 10 exponent DBL_MAX_10_EXP, // Maximum base 10 exponent
0x7ff00000u, // First word of +infinity 0x7ff00000u, // First word of +infinity
0x7ff10000u, // First word of quiet NaN 0x7ff10000u, // First word of quiet NaN
0x7ff90000u, // First word of signaling NaN 0x7ff90000u, // First word of signaling NaN
true, // conforms to iec559 true, // conforms to iec559
round_to_nearest> round_to_nearest>
{ {
public: public:
static double min() __STL_NOTHROW { return DBL_MIN; } static double min() __STL_NOTHROW { return DBL_MIN; }
...@@ -374,18 +383,18 @@ public: ...@@ -374,18 +383,18 @@ public:
}; };
template<> class numeric_limits<long double> template<> class numeric_limits<long double>
: public __floating_limits<long double, : public _Floating_limits<long double,
LDBL_MANT_DIG, // Binary digits of precision LDBL_MANT_DIG, // Binary digits of precision
LDBL_DIG, // Decimal digits of precision LDBL_DIG, // Decimal digits of precision
LDBL_MIN_EXP, // Minimum exponent LDBL_MIN_EXP, // Minimum exponent
LDBL_MAX_EXP, // Maximum exponent LDBL_MAX_EXP, // Maximum exponent
LDBL_MIN_10_EXP,// Minimum base 10 exponent LDBL_MIN_10_EXP,// Minimum base 10 exponent
LDBL_MAX_10_EXP,// Maximum base 10 exponent LDBL_MAX_10_EXP,// Maximum base 10 exponent
0x7ff00000u, // First word of +infinity 0x7ff00000u, // First word of +infinity
0x7ff10000u, // First word of quiet NaN 0x7ff10000u, // First word of quiet NaN
0x7ff90000u, // First word of signaling NaN 0x7ff90000u, // First word of signaling NaN
false, // Doesn't conform to iec559 false, // Doesn't conform to iec559
round_to_nearest> round_to_nearest>
{ {
public: public:
static long double min() __STL_NOTHROW { return LDBL_MIN; } static long double min() __STL_NOTHROW { return LDBL_MIN; }
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment