]> git.lyx.org Git - lyx.git/blobdiff - boost/boost/detail/limits.hpp
boost: add eol property
[lyx.git] / boost / boost / detail / limits.hpp
index af0f78df91abeaf72603ebe1ba2b44ae300cd7d0..6f018dfaca79badd4842f5e4cbbb623b06b0f6d2 100644 (file)
@@ -1,3 +1,7 @@
+// Copyright 2001 John Maddock
+// Distributed under the Boost Software License, Version 1.0. (See accompany-
+// ing file LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
+
 /*
  * Copyright (c) 1997
  * Silicon Graphics Computer Systems, Inc.
 #include <climits>
 #include <cfloat>
 #include <boost/config.hpp>
+#include <boost/detail/endian.hpp>
 
 #ifndef BOOST_NO_CWCHAR
 #include <cwchar> // for WCHAR_MIN and WCHAR_MAX
 #endif
 
-// The macros are not named appropriately.  We don't care about integer
-// bit layout, but about floating-point NaN (etc.) bit patterns.
-#if defined(__sparc) || defined(__sparc__) || defined(__powerpc__) || defined(__ppc__) || defined(__hppa) || defined(_MIPSEB)
-#define BOOST_BIG_ENDIAN
-#elif defined(__i386__) || defined(__alpha__)
-#define BOOST_LITTLE_ENDIAN
-#else
-#error The file boost/detail/limits.hpp needs to be set up for your CPU type.
-#endif
-
 namespace std {
 
 enum float_round_style {
@@ -94,23 +89,14 @@ enum float_denorm_style {
   static const __mem_type __mem_name = __mem_value
 #endif /* BOOST_NO_INCLASS_MEMBER_INITIALIZATION */
 
-// Deal with min/max for MinGW
-#ifdef min
-# undef min
-#endif
-
-#ifdef max
-# undef max
-#endif
-
 // Base class for all specializations of numeric_limits.
 template <class __number>
 class _Numeric_limits_base {
 public:
   BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, false);
 
-  static __number min() throw() { return __number(); }
-  static __number max() throw() { return __number(); }
+  static __number min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
+  static __number max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __number(); }
 
   BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits,   0);
   BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, 0);
@@ -159,20 +145,20 @@ template <class _Int,
           _Int __imin,
           _Int __imax,
           int __idigits = -1>
-class _Integer_limits : public _Numeric_limits_base<_Int>
+class _Integer_limits : public _Numeric_limits_base<_Int> 
 {
 public:
   BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_specialized, true);
 
-  static _Int min() throw() { return __imin; }
-  static _Int max() throw() { return __imax; }
+  static _Int min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imin; }
+  static _Int max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return __imax; }
 
   BOOST_STL_DECLARE_LIMITS_MEMBER(int,
                               digits,
                               (__idigits < 0) ? (int)(sizeof(_Int) * CHAR_BIT)
-                                                   - (__imin == 0 ? 0 : 1)
+                                                   - (__imin == 0 ? 0 : 1) 
                                               : __idigits);
-  BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000);
+  BOOST_STL_DECLARE_LIMITS_MEMBER(int, digits10, (digits * 301) / 1000); 
                                 // log 2 = 0.301029995664...
 
   BOOST_STL_DECLARE_LIMITS_MEMBER(bool, is_signed,  __imin != 0);
@@ -192,7 +178,7 @@ public:
     // sizeof(long double) == 16
     const unsigned int _S_word[4] = { Word, 0, 0, 0 };
     return *reinterpret_cast<const Number*>(&_S_word);
-  }
+  } 
 };
 
 #else
@@ -205,7 +191,7 @@ public:
     return *reinterpret_cast<const Number*>(
         reinterpret_cast<const char *>(&_S_word)+16-
                 (sizeof(Number) == 12 ? 10 : sizeof(Number)));
-  }
+  } 
 };
 
 #endif
@@ -244,7 +230,7 @@ public:
                               denorm_indeterminate);
   BOOST_STL_DECLARE_LIMITS_MEMBER(bool, has_denorm_loss,   false);
 
-
   static __number infinity() throw() {
     return float_helper<__number, __InfinityWord>::get_word();
   }
@@ -267,7 +253,7 @@ public:
 
 // The unspecialized class.
 
-template<class T>
+template<class T> 
 class numeric_limits : public _Numeric_limits_base<T> {};
 
 // Specializations for all built-in integral types.
@@ -356,24 +342,19 @@ class numeric_limits<unsigned long>
 
 #if !defined(LONGLONG_MIN)
 # define LONGLONG_MIN (-LONGLONG_MAX - 1)
-#endif
+#endif 
 
-template<>
-class numeric_limits<long long>
-  : public _Integer_limits<long long, LONGLONG_MIN, LONGLONG_MAX>
-{};
 
-template<>
-class numeric_limits<unsigned long long>
-  : public _Integer_limits<unsigned long long, 0, ULONGLONG_MAX>
-{};
+#if !defined(ULONGLONG_MIN)
+# define ULONGLONG_MIN 0
+#endif 
 
 #endif /* __GNUC__ */
 
 // Specializations for all built-in floating-point type.
 
 template<> class numeric_limits<float>
-  : public _Floating_limits<float,
+  : public _Floating_limits<float, 
                             FLT_MANT_DIG,   // Binary digits of precision
                             FLT_DIG,        // Decimal digits of precision
                             FLT_MIN_EXP,    // Minimum exponent
@@ -393,15 +374,15 @@ template<> class numeric_limits<float>
                             round_to_nearest>
 {
 public:
-  static float min() throw() { return FLT_MIN; }
+  static float min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MIN; }
   static float denorm_min() throw() { return FLT_MIN; }
-  static float max() throw() { return FLT_MAX; }
+  static float max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return FLT_MAX; }
   static float epsilon() throw() { return FLT_EPSILON; }
   static float round_error() throw() { return 0.5f; } // Units: ulps.
 };
 
 template<> class numeric_limits<double>
-  : public _Floating_limits<double,
+  : public _Floating_limits<double, 
                             DBL_MANT_DIG,   // Binary digits of precision
                             DBL_DIG,        // Decimal digits of precision
                             DBL_MIN_EXP,    // Minimum exponent
@@ -421,15 +402,15 @@ template<> class numeric_limits<double>
                             round_to_nearest>
 {
 public:
-  static double min() throw() { return DBL_MIN; }
+  static double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MIN; }
   static double denorm_min() throw() { return DBL_MIN; }
-  static double max() throw() { return DBL_MAX; }
+  static double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return DBL_MAX; }
   static double epsilon() throw() { return DBL_EPSILON; }
   static double round_error() throw() { return 0.5; } // Units: ulps.
 };
 
 template<> class numeric_limits<long double>
-  : public _Floating_limits<long double,
+  : public _Floating_limits<long double, 
                             LDBL_MANT_DIG,  // Binary digits of precision
                             LDBL_DIG,       // Decimal digits of precision
                             LDBL_MIN_EXP,   // Minimum exponent
@@ -449,9 +430,9 @@ template<> class numeric_limits<long double>
                             round_to_nearest>
 {
 public:
-  static long double min() throw() { return LDBL_MIN; }
+  static long double min BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MIN; }
   static long double denorm_min() throw() { return LDBL_MIN; }
-  static long double max() throw() { return LDBL_MAX; }
+  static long double max BOOST_PREVENT_MACRO_SUBSTITUTION () throw() { return LDBL_MAX; }
   static long double epsilon() throw() { return LDBL_EPSILON; }
   static long double round_error() throw() { return 4; } // Units: ulps.
 };
@@ -463,3 +444,6 @@ public:
 // Local Variables:
 // mode:C++
 // End:
+
+
+