* software for any purpose. It is provided "as is" without express or
* implied warranty.
*
- * $Id: integer_traits.hpp,v 1.19 2002/07/13 12:26:19 david_abrahams Exp $
+ * $Id: integer_traits.hpp,v 1.11 2003/08/07 12:09:23 larsbj Exp $
*
* Idea by Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers
*/
+// See http://www.boost.org/libs/integer for documentation.
+
+
#ifndef BOOST_INTEGER_TRAITS_HPP
#define BOOST_INTEGER_TRAITS_HPP
#elif defined(__BORLANDC__) || defined(__CYGWIN__) || defined(__MINGW32__) || (defined(__BEOS__) && defined(__GNUC__))
// No WCHAR_MIN and WCHAR_MAX, whar_t is short and unsigned:
public detail::integer_traits_base<wchar_t, 0, 0xffff>
-#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400)) || (defined __APPLE__) || (defined(__FreeBSD__) && defined(__GNUC__)) || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT))
+#elif (defined(__sgi) && (!defined(__SGI_STL_PORT) || __SGI_STL_PORT < 0x400))\
+ || (defined __APPLE__)\
+ || (defined(__OpenBSD__) && defined(__GNUC__))\
+ || (defined(__NetBSD__) && defined(__GNUC__))\
+ || (defined(__FreeBSD__) && defined(__GNUC__))\
+ || (defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 3) && !defined(__SGI_STL_PORT))
// No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as int.
// - SGI MIPSpro with native library
// - gcc 3.x on HP-UX
// - Mac OS X with native library
- // - gcc on FreeBSD
+ // - gcc on FreeBSD, OpenBSD and NetBSD
public detail::integer_traits_base<wchar_t, INT_MIN, INT_MAX>
#elif defined(__hpux) && defined(__GNUC__) && (__GNUC__ == 2) && !defined(__SGI_STL_PORT)
// No WCHAR_MIN and WCHAR_MAX, wchar_t has the same range as unsigned int.
public detail::integer_traits_base<unsigned long, 0, ULONG_MAX>
{ };
-#if defined(ULLONG_MAX) && !defined(__SUNPRO_CC)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T)
+#if defined(ULLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
template<>
class integer_traits<long long>
: public std::numeric_limits<long long>,
public detail::integer_traits_base<long long, LLONG_MIN, LLONG_MAX>
{ };
+
template<>
class integer_traits<unsigned long long>
: public std::numeric_limits<unsigned long long>,
public detail::integer_traits_base<unsigned long long, 0, ULLONG_MAX>
{ };
-#elif defined(ULONG_LONG_MAX)
+
+#elif defined(ULONG_LONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
template<>
-class integer_traits<long long>
- : public std::numeric_limits<long long>,
- public detail::integer_traits_base<long long, LONG_LONG_MIN, LONG_LONG_MAX>
-{ };
+class integer_traits<long long> : public std::numeric_limits<long long>, public detail::integer_traits_base<long long, LONG_LONG_MIN, LONG_LONG_MAX>{ };
template<>
class integer_traits<unsigned long long>
: public std::numeric_limits<unsigned long long>,
public detail::integer_traits_base<unsigned long long, 0, ULONG_LONG_MAX>
{ };
-#elif defined(ULONGLONG_MAX) && !defined(BOOST_MSVC) && !defined(__BORLANDC__)
+
+#elif defined(ULONGLONG_MAX) && defined(BOOST_HAS_LONG_LONG)
+
template<>
class integer_traits<long long>
: public std::numeric_limits<long long>,
public detail::integer_traits_base<long long, LONGLONG_MIN, LONGLONG_MAX>
{ };
+
template<>
class integer_traits<unsigned long long>
: public std::numeric_limits<unsigned long long>,
public detail::integer_traits_base<unsigned long long, 0, ULONGLONG_MAX>
{ };
+
+#elif defined(_LLONG_MAX) && defined(_C2) && defined(BOOST_HAS_LONG_LONG)
+
+template<>
+class integer_traits<long long>
+ : public std::numeric_limits<long long>,
+ public detail::integer_traits_base<long long, -_LLONG_MAX - _C2, _LLONG_MAX>
+{ };
+
+template<>
+class integer_traits<unsigned long long>
+ : public std::numeric_limits<unsigned long long>,
+ public detail::integer_traits_base<unsigned long long, 0, _ULLONG_MAX>
+{ };
+
+#endif
#endif
} // namespace boost
#endif /* BOOST_INTEGER_TRAITS_HPP */
+