Attempt to represent the S^2->S^3 header reorganisation as a series of "hg rename" operations
2 * © Portions copyright (c) 2006-2007 Nokia Corporation. All rights reserved.
4 * Silicon Graphics Computer Systems, Inc.
9 * This material is provided "as is", with absolutely no warranty expressed
10 * or implied. Any use is at your own risk.
12 * Permission to use or copy this software for any purpose is hereby granted
13 * without fee, provided the above notices are retained on all copies.
14 * Permission to modify the code and to distribute modified code is granted,
15 * provided the above notices are retained, and a notice that the code was
16 * modified is included with the above copyright notice.
20 /* NOTE: This may be not portable code. Parts of numeric_limits<> are
21 * inherently machine-dependent. At present this file is suitable
22 * for the MIPS, SPARC, Alpha and ia32 architectures.
25 #ifndef _STLP_INTERNAL_LIMITS_H
26 # define _STLP_INTERNAL_LIMITS_H
36 #if !defined (_STLP_NO_WCHAR_T) && !defined (_STLP_CWCHAR_H)
37 # include <stl/_cwchar.h>
42 enum float_round_style {
43 round_indeterminate = -1,
44 round_toward_zero = 0,
46 round_toward_infinity = 2,
47 round_toward_neg_infinity = 3
50 enum float_denorm_style {
51 denorm_indeterminate = -1,
56 // Base class for all specializations of numeric_limits.
58 template <class __number>
59 class _Numeric_limits_base {
62 static __number (_STLP_CALL min)() _STLP_NOTHROW { return __number(); }
63 static __number (_STLP_CALL max)() _STLP_NOTHROW { return __number(); }
65 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
79 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
81 has_denorm = denorm_absent,
82 round_style = round_toward_zero,
85 static const float_denorm_style has_denorm = denorm_absent;
86 static const float_round_style round_style = round_toward_zero;
90 is_specialized = false,
95 has_quiet_NaN = false,
96 has_signaling_NaN = false,
97 has_denorm_loss = false,
102 tinyness_before = false
103 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
108 static __number _STLP_CALL epsilon() _STLP_NOTHROW { return __number(); }
109 static __number _STLP_CALL round_error() _STLP_NOTHROW { return __number(); }
111 static __number _STLP_CALL infinity() _STLP_NOTHROW { return __number(); }
112 static __number _STLP_CALL quiet_NaN() _STLP_NOTHROW { return __number(); }
113 static __number _STLP_CALL signaling_NaN() _STLP_NOTHROW { return __number(); }
114 static __number _STLP_CALL denorm_min() _STLP_NOTHROW { return __number(); }
119 // Base class for integers.
121 # ifdef _STLP_LIMITED_DEFAULT_TEMPLATES
122 # ifdef _STLP_LONG_LONG
123 # define _STLP_LIMITS_MIN_TYPE _STLP_LONG_LONG
124 # define _STLP_LIMITS_MAX_TYPE unsigned _STLP_LONG_LONG
126 # define _STLP_LIMITS_MIN_TYPE long
127 # define _STLP_LIMITS_MAX_TYPE unsigned long
130 # define _STLP_LIMITS_MIN_TYPE _Int
131 # define _STLP_LIMITS_MAX_TYPE _Int
132 # endif /* _STLP_LIMITED_DEFAULT_TEMPLATES */
134 template <class _Int,
135 _STLP_LIMITS_MIN_TYPE __imin,
136 _STLP_LIMITS_MAX_TYPE __imax,
137 int __idigits, bool __ismod>
138 class _Integer_limits : public _Numeric_limits_base<_Int>
142 static _Int (_STLP_CALL min) () _STLP_NOTHROW { return (_Int)__imin; }
143 static _Int (_STLP_CALL max) () _STLP_NOTHROW { return (_Int)__imax; }
145 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
150 digits = (__idigits < 0) ?
151 ((int)((sizeof(_Int) * (CHAR_BIT))) - ((__imin == 0) ? 0 : 1))
153 digits10 = (digits * 301UL) / 1000,
155 # if ! defined ( _STLP_STATIC_CONST_INIT_BUG)
161 is_specialized = true,
162 is_signed = (__imin != 0),
167 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
173 // Base class for floating-point numbers.
174 template <class __number,
175 int __Digits, int __Digits10,
176 int __MinExp, int __MaxExp,
177 int __MinExp10, int __MaxExp10,
179 float_round_style __RoundStyle>
180 class _Floating_limits : public _Numeric_limits_base<__number>
184 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
191 digits10 = __Digits10,
193 radix = ( FLT_RADIX /* 2 */ ),
194 min_exponent = __MinExp,
195 max_exponent = __MaxExp,
196 min_exponent10 = __MinExp10,
197 max_exponent10 = __MaxExp10
199 # if defined (_STLP_STATIC_CONST_INIT_BUG)
201 has_denorm = denorm_indeterminate,
202 round_style = __RoundStyle,
205 static const float_denorm_style has_denorm = denorm_indeterminate;
206 static const float_round_style round_style = __RoundStyle;
210 is_specialized = true,
213 #if (!defined(_CRAY) || !defined(_CRAYIEEE))
215 has_quiet_NaN = true,
216 has_signaling_NaN= true,
218 has_infinity = false,
219 has_quiet_NaN = false,
220 has_signaling_NaN= false,
223 has_denorm_loss = false,
224 is_iec559 = __IsIEC559,
227 tinyness_before= false
229 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
236 // Class numeric_limits
238 // The unspecialized class.
241 class numeric_limits : public _Numeric_limits_base<_Tp> {};
243 // Specializations for all built-in integral types.
245 #ifndef _STLP_NO_BOOL
248 class numeric_limits<bool>
249 : public _Integer_limits<bool, false, true, 1, false>
252 #endif /* _STLP_NO_BOOL */
255 class numeric_limits<char>
256 : public _Integer_limits<char, CHAR_MIN, CHAR_MAX, -1, true>
259 # ifndef _STLP_NO_SIGNED_BUILTINS
261 class numeric_limits<signed char>
262 : public _Integer_limits<signed char, SCHAR_MIN, SCHAR_MAX, -1, true>
267 class numeric_limits<unsigned char>
268 : public _Integer_limits<unsigned char, 0, UCHAR_MAX, -1, true>
272 #if !defined ( _STLP_NO_WCHAR_T )
274 class numeric_limits<wchar_t>
275 : public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
280 #if !(defined ( _STLP_NO_WCHAR_T ) || defined (_STLP_WCHAR_T_IS_USHORT))
283 class numeric_limits<wchar_t>
284 : public _Integer_limits<wchar_t, WCHAR_MIN, WCHAR_MAX, -1, true>
290 class numeric_limits<short>
291 : public _Integer_limits<short, SHRT_MIN, SHRT_MAX, -1, true>
295 class numeric_limits<unsigned short>
296 : public _Integer_limits<unsigned short, 0, USHRT_MAX, -1, true>
299 # if defined (__xlC__) && (__xlC__ == 0x500)
301 # define INT_MIN -2147483648
306 class numeric_limits<int>
307 : public _Integer_limits<int, INT_MIN, INT_MAX, -1, true>
311 class numeric_limits<unsigned int>
312 : public _Integer_limits<unsigned int, 0, UINT_MAX, -1, true>
316 class numeric_limits<long>
317 : public _Integer_limits<long, LONG_MIN, LONG_MAX, -1, true>
321 class numeric_limits<unsigned long>
322 : public _Integer_limits<unsigned long, 0, ULONG_MAX, -1, true>
325 #ifdef _STLP_LONG_LONG
327 # if defined (_STLP_MSVC) || defined (__BORLANDC__)
329 # define LONGLONG_MAX 0x7fffffffffffffffi64
330 # define LONGLONG_MIN (-LONGLONG_MAX-1i64)
331 # define ULONGLONG_MAX 0xffffffffffffffffUi64
335 # ifndef LONGLONG_MAX
336 # define LONGLONG_MAX 0x7fffffffffffffffLL
338 # ifndef LONGLONG_MIN
339 # define LONGLONG_MIN (-LONGLONG_MAX-1LL)
341 # ifndef ULONGLONG_MAX
342 # define ULONGLONG_MAX 0xffffffffffffffffULL
347 #if !defined(__GNUC__) || (__GNUC__ == 2 && __GNUC_MINOR__ <= 96)
350 class numeric_limits<_STLP_LONG_LONG>
351 : public _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
355 class numeric_limits<unsigned _STLP_LONG_LONG>
356 : public _Integer_limits<unsigned _STLP_LONG_LONG, 0, ULONGLONG_MAX, -1, true>
358 #else /* gcc 2.97 (after 2000-11-01), 2.98, 3.0 */
360 newest gcc has new mangling scheme, that has problem
361 with generating name [instantiated] of template specialization like
362 _Integer_limits<_STLP_LONG_LONG, LONGLONG_MIN, LONGLONG_MAX, -1, true>
363 ~~~~~~~~~~~~ ~~~~~~~~~~~~
364 Below is code that solve this problem.
368 class numeric_limits<_STLP_LONG_LONG>
369 : public _Numeric_limits_base<_STLP_LONG_LONG>
373 static _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return LONGLONG_MIN; }
374 static _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return LONGLONG_MAX; }
376 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
381 digits = ((int)((sizeof(_STLP_LONG_LONG) * (CHAR_BIT))) - 1),
382 digits10 = (digits * 301UL) / 1000,
384 # if ! defined ( _STLP_STATIC_CONST_INIT_BUG)
390 is_specialized = true,
396 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
403 class numeric_limits<unsigned _STLP_LONG_LONG>
404 : public _Numeric_limits_base<unsigned _STLP_LONG_LONG>
408 static unsigned _STLP_LONG_LONG (_STLP_CALL min) () _STLP_NOTHROW { return 0ULL; }
409 static unsigned _STLP_LONG_LONG (_STLP_CALL max) () _STLP_NOTHROW { return ULONGLONG_MAX; }
411 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
416 digits = ((int)((sizeof(unsigned _STLP_LONG_LONG) * (CHAR_BIT)))),
417 digits10 = (digits * 301UL) / 1000,
419 # if ! defined ( _STLP_STATIC_CONST_INIT_BUG)
425 is_specialized = true,
431 # if defined ( _STLP_STATIC_CONST_INIT_BUG)
437 # endif /* __GNUC__ > 2000-11-01 */
439 #endif /* _STLP_LONG_LONG */
441 // Specializations for all built-in floating-point types.
445 unsigned short rep[2];
450 unsigned short rep[4];
454 # ifndef _STLP_NO_LONG_DOUBLE
457 unsigned short rep[8];
462 template <class __dummy>
466 static const _F_rep _F_inf;
467 static const _F_rep _F_qNaN;
468 static const _F_rep _F_sNaN;
469 static const _D_rep _D_inf;
470 static const _D_rep _D_qNaN;
471 static const _D_rep _D_sNaN;
473 # ifndef _STLP_NO_LONG_DOUBLE
474 static const _L_rep _L_inf;
475 static const _L_rep _L_qNaN;
476 static const _L_rep _L_sNaN;
480 # if defined (_STLP_USE_TEMPLATE_EXPORT)
481 _STLP_EXPORT_TEMPLATE_CLASS _LimG<bool>;
484 _STLP_TEMPLATE_NULL class numeric_limits<float>
485 : public _Floating_limits<float,
486 FLT_MANT_DIG, // Binary digits of precision
487 FLT_DIG, // Decimal digits of precision
488 FLT_MIN_EXP, // Minimum exponent
489 FLT_MAX_EXP, // Maximum exponent
490 FLT_MIN_10_EXP, // Minimum base 10 exponent
491 FLT_MAX_10_EXP, // Maximum base 10 exponent
492 true, // conforms to iec559
496 static float (_STLP_CALL min) () _STLP_NOTHROW { return FLT_MIN; }
497 static float _STLP_CALL denorm_min() _STLP_NOTHROW { return FLT_MIN; }
498 static float (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return FLT_MAX; }
499 static float _STLP_CALL epsilon() _STLP_NOTHROW { return FLT_EPSILON; }
500 static float _STLP_CALL round_error() _STLP_NOTHROW { return 0.5f; } // Units: ulps.
501 static float _STLP_CALL infinity() { return _LimG<bool>::_F_inf.val; }
502 static float _STLP_CALL quiet_NaN() { return _LimG<bool>::_F_qNaN.val; }
503 static float _STLP_CALL signaling_NaN() { return _LimG<bool>::_F_sNaN.val; }
506 _STLP_TEMPLATE_NULL class numeric_limits<double>
507 : public _Floating_limits<double,
508 DBL_MANT_DIG, // Binary digits of precision
509 DBL_DIG, // Decimal digits of precision
510 DBL_MIN_EXP, // Minimum exponent
511 DBL_MAX_EXP, // Maximum exponent
512 DBL_MIN_10_EXP, // Minimum base 10 exponent
513 DBL_MAX_10_EXP, // Maximum base 10 exponent
514 true, // conforms to iec559
518 static double (_STLP_CALL min)() _STLP_NOTHROW { return DBL_MIN; }
519 static double _STLP_CALL denorm_min() _STLP_NOTHROW { return DBL_MIN; }
520 static double (_STLP_CALL max)() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return DBL_MAX; }
521 static double _STLP_CALL epsilon() _STLP_NOTHROW { return DBL_EPSILON; }
522 static double _STLP_CALL round_error() _STLP_NOTHROW { return 0.5; } // Units: ulps.
523 static double _STLP_CALL infinity() { return _LimG<bool>::_D_inf.val; }
524 static double _STLP_CALL quiet_NaN(){ return _LimG<bool>::_D_qNaN.val; }
525 static double _STLP_CALL signaling_NaN() { return _LimG<bool>::_D_sNaN.val; }
528 # ifndef _STLP_NO_LONG_DOUBLE
531 class numeric_limits<long double>
532 : public _Floating_limits<long double,
533 LDBL_MANT_DIG, // Binary digits of precision
534 LDBL_DIG, // Decimal digits of precision
535 LDBL_MIN_EXP, // Minimum exponent
536 LDBL_MAX_EXP, // Maximum exponent
537 LDBL_MIN_10_EXP,// Minimum base 10 exponent
538 LDBL_MAX_10_EXP,// Maximum base 10 exponent
539 false, // Doesn't conform to iec559
543 static long double (_STLP_CALL min) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
544 static long double _STLP_CALL denorm_min() _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MIN; }
545 static long double (_STLP_CALL max) () _STLP_NOTHROW { _STLP_USING_VENDOR_CSTD return LDBL_MAX; }
546 static long double _STLP_CALL epsilon() _STLP_NOTHROW { return LDBL_EPSILON; }
547 static long double _STLP_CALL round_error() _STLP_NOTHROW { return 4; } // Units: ulps.
548 static long double _STLP_CALL infinity() { return _LimG<bool>::_L_inf.val; }
549 static long double _STLP_CALL quiet_NaN() { return _LimG<bool>::_L_qNaN.val; }
550 static long double _STLP_CALL signaling_NaN() { return _LimG<bool>::_L_sNaN.val; }
555 // We write special values (Inf and NaN) as bit patterns and
556 // cast the the appropriate floating-point types.
559 # if !defined (_STLP_LINK_TIME_INSTANTIATION)
560 # include <stl/_limits.c>