|
Boost-Commit : |
Subject: [Boost-commit] svn:boost r58381 - in branches/release: boost boost/config boost/config/compiler boost/integer libs/integer libs/integer/doc libs/integer/doc/html libs/integer/doc/html/boost_integer libs/integer/test
From: john_at_[hidden]
Date: 2009-12-14 13:14:50
Author: johnmaddock
Date: 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
New Revision: 58381
URL: http://svn.boost.org/trac/boost/changeset/58381
Log:
Merge both config and integer changes from Trunk: these are interlinked.
Added:
branches/release/libs/integer/doc/Jamfile.v2
- copied unchanged from r58379, /trunk/libs/integer/doc/Jamfile.v2
branches/release/libs/integer/doc/html/
- copied from r58379, /trunk/libs/integer/doc/html/
branches/release/libs/integer/doc/html/boost_integer/
- copied from r58379, /trunk/libs/integer/doc/html/boost_integer/
branches/release/libs/integer/doc/html/boost_integer/cstdint.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/cstdint.html
branches/release/libs/integer/doc/html/boost_integer/history.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/history.html
branches/release/libs/integer/doc/html/boost_integer/integer.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/integer.html
branches/release/libs/integer/doc/html/boost_integer/log2.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/log2.html
branches/release/libs/integer/doc/html/boost_integer/mask.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/mask.html
branches/release/libs/integer/doc/html/boost_integer/minmax.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/minmax.html
branches/release/libs/integer/doc/html/boost_integer/traits.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/boost_integer/traits.html
branches/release/libs/integer/doc/html/index.html
- copied unchanged from r58379, /trunk/libs/integer/doc/html/index.html
branches/release/libs/integer/doc/integer.qbk
- copied unchanged from r58379, /trunk/libs/integer/doc/integer.qbk
branches/release/libs/integer/test/cstdint_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/cstdint_include_test.cpp
branches/release/libs/integer/test/cstdint_test2.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/cstdint_test2.cpp
branches/release/libs/integer/test/integer_fwd_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/integer_fwd_include_test.cpp
branches/release/libs/integer/test/integer_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/integer_include_test.cpp
branches/release/libs/integer/test/integer_mask_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/integer_mask_include_test.cpp
branches/release/libs/integer/test/integer_traits_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/integer_traits_include_test.cpp
branches/release/libs/integer/test/static_log2_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/static_log2_include_test.cpp
branches/release/libs/integer/test/static_min_max_include_test.cpp
- copied unchanged from r58379, /trunk/libs/integer/test/static_min_max_include_test.cpp
Removed:
branches/release/libs/integer/cstdint.htm
branches/release/libs/integer/doc/integer_mask.html
branches/release/libs/integer/doc/static_log2.html
branches/release/libs/integer/doc/static_min_max.html
branches/release/libs/integer/integer.htm
branches/release/libs/integer/integer_traits.html
Properties modified:
branches/release/boost/config/ (props changed)
branches/release/boost/integer/ (props changed)
branches/release/libs/integer/ (props changed)
Text files modified:
branches/release/boost/config/compiler/borland.hpp | 2
branches/release/boost/config/compiler/codegear.hpp | 21
branches/release/boost/config/compiler/visualc.hpp | 2
branches/release/boost/cstdint.hpp | 94 ++++--
branches/release/boost/integer.hpp | 214 +++++++++++++---
branches/release/boost/integer/integer_mask.hpp | 9
branches/release/boost/integer/static_log2.hpp | 11
branches/release/boost/integer/static_min_max.hpp | 20
branches/release/boost/integer_fwd.hpp | 46 ++
branches/release/boost/integer_traits.hpp | 25 ++
branches/release/libs/integer/index.html | 135 ----------
branches/release/libs/integer/test/Jamfile.v2 | 29 +
branches/release/libs/integer/test/cstdint_test.cpp | 141 +++++-----
branches/release/libs/integer/test/integer_mask_test.cpp | 33 +
branches/release/libs/integer/test/integer_test.cpp | 488 ++++++++++++++++++---------------------
branches/release/libs/integer/test/integer_traits_test.cpp | 23
branches/release/libs/integer/test/static_log2_test.cpp | 9
branches/release/libs/integer/test/static_min_max_test.cpp | 83 +++---
18 files changed, 731 insertions(+), 654 deletions(-)
Modified: branches/release/boost/config/compiler/borland.hpp
==============================================================================
--- branches/release/boost/config/compiler/borland.hpp (original)
+++ branches/release/boost/config/compiler/borland.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -66,7 +66,6 @@
// Borland C++ Builder 6 and below:
#if (__BORLANDC__ <= 0x564)
-# define BOOST_NO_INTEGRAL_INT64_T
# ifdef NDEBUG
// fix broken <cstring> so that Boost.test works:
@@ -121,6 +120,7 @@
#endif
// Borland C++ Builder 2008 and below:
+# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
Modified: branches/release/boost/config/compiler/codegear.hpp
==============================================================================
--- branches/release/boost/config/compiler/codegear.hpp (original)
+++ branches/release/boost/config/compiler/codegear.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -19,8 +19,8 @@
#endif
//
// versions check:
-// last known and checked version is 0x610
-#if (__CODEGEARC__ > 0x613)
+// last known and checked version is 0x620
+#if (__CODEGEARC__ > 0x620)
# if defined(BOOST_ASSERT_CONFIG)
# error "Unknown compiler version - please run the configure tests and report the results"
# else
@@ -30,20 +30,24 @@
// CodeGear C++ Builder 2009
#if (__CODEGEARC__ <= 0x613)
-# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+# define BOOST_NO_INTEGRAL_INT64_T
# define BOOST_NO_DEPENDENT_NESTED_DERIVATIONS
-# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
# define BOOST_NO_PRIVATE_IN_AGGREGATE
-# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
# define BOOST_NO_USING_DECLARATION_OVERLOADS_FROM_TYPENAME_BASE
-# define BOOST_NO_USING_TEMPLATE
// we shouldn't really need this - but too many things choke
// without it, this needs more investigation:
# define BOOST_NO_LIMITS_COMPILE_TIME_CONSTANTS
-# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
-# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
# define BOOST_SP_NO_SP_CONVERTIBLE
+#endif
+// CodeGear C++ Builder 2010
+#if (__CODEGEARC__ <= 0x620)
+# define BOOST_NO_TYPENAME_WITH_CTOR // Cannot use typename keyword when making temporaries of a dependant type
+# define BOOST_FUNCTION_SCOPE_USING_DECLARATION_BREAKS_ADL
+# define BOOST_NO_MEMBER_TEMPLATE_FRIENDS
+# define BOOST_NO_NESTED_FRIENDSHIP // TC1 gives nested classes access rights as any other member
+# define BOOST_NO_USING_TEMPLATE
+# define BOOST_NO_TWO_PHASE_NAME_LOOKUP
// Temporary hack, until specific MPL preprocessed headers are generated
# define BOOST_MPL_CFG_NO_PREPROCESSED_HEADERS
@@ -59,7 +63,6 @@
# endif
#endif
-
//
// C++0x macros:
//
Modified: branches/release/boost/config/compiler/visualc.hpp
==============================================================================
--- branches/release/boost/config/compiler/visualc.hpp (original)
+++ branches/release/boost/config/compiler/visualc.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -125,7 +125,7 @@
#if (_MSC_VER >= 1200)
# define BOOST_HAS_MS_INT64
#endif
-#if (_MSC_VER >= 1310) && defined(_MSC_EXTENSIONS)
+#if (_MSC_VER >= 1310) && (defined(_MSC_EXTENSIONS) || (_MSC_VER >= 1500))
# define BOOST_HAS_LONG_LONG
#else
# define BOOST_NO_LONG_LONG
Modified: branches/release/boost/cstdint.hpp
==============================================================================
--- branches/release/boost/cstdint.hpp (original)
+++ branches/release/boost/cstdint.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -23,10 +23,25 @@
#ifndef BOOST_CSTDINT_HPP
#define BOOST_CSTDINT_HPP
-#include <boost/config.hpp>
+//
+// Since we always define the INT#_C macros as per C++0x,
+// define __STDC_CONSTANT_MACROS so that <stdint.h> does the right
+// thing if possible, and so that the user knows that the macros
+// are actually defined as per C99.
+//
+#ifndef __STDC_CONSTANT_MACROS
+# define __STDC_CONSTANT_MACROS
+#endif
+#include <boost/config.hpp>
-#ifdef BOOST_HAS_STDINT_H
+//
+// Note that GLIBC is a bit inconsistent about whether int64_t is defined or not
+// depending upon what headers happen to have been included first...
+// so we disable use of stdint.h when GLIBC does not define __GLIBC_HAVE_LONG_LONG.
+// See https://svn.boost.org/trac/boost/ticket/3548 and http://sources.redhat.com/bugzilla/show_bug.cgi?id=10990
+//
+#if defined(BOOST_HAS_STDINT_H) && (!defined(__GLIBC__) || defined(__GLIBC_HAVE_LONG_LONG))
// The following #include is an implementation artifact; not part of interface.
# ifdef __hpux
@@ -220,6 +235,15 @@
typedef unsigned short uint_least16_t;
typedef unsigned short uint_fast16_t;
# endif
+# elif (USHRT_MAX == 0xffffffff) && defined(__MTA__)
+ // On MTA / XMT short is 32 bits unless the -short16 compiler flag is specified
+ // MTA / XMT does support the following non-standard integer types
+ typedef __short16 int16_t;
+ typedef __short16 int_least16_t;
+ typedef __short16 int_fast16_t;
+ typedef unsigned __short16 uint16_t;
+ typedef unsigned __short16 uint_least16_t;
+ typedef unsigned __short16 uint_fast16_t;
# elif (USHRT_MAX == 0xffffffff) && defined(CRAY)
// no 16-bit types on Cray:
typedef short int_least16_t;
@@ -246,6 +270,14 @@
typedef unsigned int uint32_t;
typedef unsigned int uint_least32_t;
typedef unsigned int uint_fast32_t;
+# elif (UINT_MAX == 0xffffffffffffffff) && defined(__MTA__)
+ // Integers are 64 bits on the MTA / XMT
+ typedef __int32 int32_t;
+ typedef __int32 int_least32_t;
+ typedef __int32 int_fast32_t;
+ typedef unsigned __int32 uint32_t;
+ typedef unsigned __int32 uint_least32_t;
+ typedef unsigned __int32 uint_fast32_t;
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
@@ -326,19 +358,16 @@
Macro definition section:
-Define various INTXX_C macros only if
-__STDC_CONSTANT_MACROS is defined.
-
-Undefine the macros if __STDC_CONSTANT_MACROS is
-not defined and the macros are (cf <cassert>).
-
Added 23rd September 2000 (John Maddock).
Modified 11th September 2001 to be excluded when
BOOST_HAS_STDINT_H is defined (John Maddock).
+Modified 11th Dec 2009 to always define the
+INT#_C macros if they're not already defined (John Maddock).
******************************************************/
-#if defined(__STDC_CONSTANT_MACROS) && !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(BOOST_HAS_STDINT_H)
+#if !defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(INT8_C)
+#include <limits.h>
# define BOOST__STDC_CONSTANT_MACROS_DEFINED
# if defined(BOOST_HAS_MS_INT64)
//
@@ -390,27 +419,40 @@
// 64-bit types + intmax_t and uintmax_t ----------------------------------//
# if defined(BOOST_HAS_LONG_LONG) && \
- (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX))
+ (defined(ULLONG_MAX) || defined(ULONG_LONG_MAX) || defined(ULONGLONG_MAX) || defined(_LLONG_MAX))
# if defined(__hpux)
- // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
-# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615U) || \
- (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615U) || \
- (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615U)
+ // HP-UX's value of ULONG_LONG_MAX is unusable in preprocessor expressions
+# define INT64_C(value) value##LL
+# define UINT64_C(value) value##uLL
+# elif (defined(ULLONG_MAX) && ULLONG_MAX == 18446744073709551615ULL) || \
+ (defined(ULONG_LONG_MAX) && ULONG_LONG_MAX == 18446744073709551615ULL) || \
+ (defined(ULONGLONG_MAX) && ULONGLONG_MAX == 18446744073709551615ULL) || \
+ (defined(_LLONG_MAX) && _LLONG_MAX == 18446744073709551615ULL)
+# define INT64_C(value) value##LL
+# define UINT64_C(value) value##uLL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
-# define INT64_C(value) value##LL
-# define UINT64_C(value) value##uLL
# elif ULONG_MAX != 0xffffffff
-# if ULONG_MAX == 18446744073709551615 // 2**64 - 1
+# if ULONG_MAX == 18446744073709551615U // 2**64 - 1
# define INT64_C(value) value##L
# define UINT64_C(value) value##uL
# else
# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
+# elif defined(BOOST_HAS_LONG_LONG)
+ // Usual macros not defined, work things out for ourselves:
+# if(~0uLL == 18446744073709551615ULL)
+# define INT64_C(value) value##LL
+# define UINT64_C(value) value##uLL
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
+# endif
+# else
+# error defaults not correct; you must hand modify boost/cstdint.hpp
# endif
# ifdef BOOST_NO_INT64_T
@@ -423,23 +465,7 @@
# endif // Borland/Microsoft specific width suffixes
-
-#elif defined(BOOST__STDC_CONSTANT_MACROS_DEFINED) && !defined(__STDC_CONSTANT_MACROS) && !defined(BOOST_HAS_STDINT_H)
-//
-// undef all the macros:
-//
-# undef INT8_C
-# undef INT16_C
-# undef INT32_C
-# undef INT64_C
-# undef UINT8_C
-# undef UINT16_C
-# undef UINT32_C
-# undef UINT64_C
-# undef INTMAX_C
-# undef UINTMAX_C
-
-#endif // __STDC_CONSTANT_MACROS_DEFINED etc.
+#endif // INT#_C macros.
Modified: branches/release/boost/integer.hpp
==============================================================================
--- branches/release/boost/integer.hpp (original)
+++ branches/release/boost/integer.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -17,8 +17,21 @@
#include <boost/integer_fwd.hpp> // self include
-#include <boost/integer_traits.hpp> // for boost::integer_traits
-#include <boost/limits.hpp> // for std::numeric_limits
+#include <boost/integer_traits.hpp> // for boost::::boost::integer_traits
+#include <boost/limits.hpp> // for ::std::numeric_limits
+#include <boost/cstdint.hpp> // for boost::int64_t and BOOST_NO_INTEGRAL_INT64_T
+
+//
+// We simply cannot include this header on gcc without getting copious warnings of the kind:
+//
+// boost/integer.hpp:77:30: warning: use of C99 long long integer constant
+//
+// And yet there is no other reasonable implementation, so we declare this a system header
+// to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
namespace boost
{
@@ -28,7 +41,13 @@
// fast integers from least integers
// int_fast_t<> works correctly for unsigned too, in spite of the name.
template< typename LeastInt >
- struct int_fast_t { typedef LeastInt fast; }; // imps may specialize
+ struct int_fast_t
+ {
+ typedef LeastInt fast;
+ typedef fast type;
+ }; // imps may specialize
+
+ namespace detail{
// convert category to type
template< int Category > struct int_least_helper {}; // default is empty
@@ -36,89 +55,196 @@
// specializatons: 1=long, 2=int, 3=short, 4=signed char,
// 6=unsigned long, 7=unsigned int, 8=unsigned short, 9=unsigned char
// no specializations for 0 and 5: requests for a type > long are in error
- template<> struct int_least_helper<1> { typedef long least; };
- template<> struct int_least_helper<2> { typedef int least; };
- template<> struct int_least_helper<3> { typedef short least; };
- template<> struct int_least_helper<4> { typedef signed char least; };
- template<> struct int_least_helper<6> { typedef unsigned long least; };
- template<> struct int_least_helper<7> { typedef unsigned int least; };
- template<> struct int_least_helper<8> { typedef unsigned short least; };
- template<> struct int_least_helper<9> { typedef unsigned char least; };
+#ifdef BOOST_HAS_LONG_LONG
+ template<> struct int_least_helper<1> { typedef boost::long_long_type least; };
+#endif
+ template<> struct int_least_helper<2> { typedef long least; };
+ template<> struct int_least_helper<3> { typedef int least; };
+ template<> struct int_least_helper<4> { typedef short least; };
+ template<> struct int_least_helper<5> { typedef signed char least; };
+#ifdef BOOST_HAS_LONG_LONG
+ template<> struct int_least_helper<6> { typedef boost::ulong_long_type least; };
+#endif
+ template<> struct int_least_helper<7> { typedef unsigned long least; };
+ template<> struct int_least_helper<8> { typedef unsigned int least; };
+ template<> struct int_least_helper<9> { typedef unsigned short least; };
+ template<> struct int_least_helper<10> { typedef unsigned char least; };
+
+ template <int Bits>
+ struct exact_signed_base_helper{};
+ template <int Bits>
+ struct exact_unsigned_base_helper{};
+
+ template <> struct exact_signed_base_helper<sizeof(signed char)* CHAR_BIT> { typedef signed char exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(unsigned char)* CHAR_BIT> { typedef unsigned char exact; };
+#if USHRT_MAX != UCHAR_MAX
+ template <> struct exact_signed_base_helper<sizeof(short)* CHAR_BIT> { typedef short exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(unsigned short)* CHAR_BIT> { typedef unsigned short exact; };
+#endif
+#if UINT_MAX != USHRT_MAX
+ template <> struct exact_signed_base_helper<sizeof(int)* CHAR_BIT> { typedef int exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(unsigned int)* CHAR_BIT> { typedef unsigned int exact; };
+#endif
+#if ULONG_MAX != UINT_MAX
+ template <> struct exact_signed_base_helper<sizeof(long)* CHAR_BIT> { typedef long exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(unsigned long)* CHAR_BIT> { typedef unsigned long exact; };
+#endif
+#if defined(BOOST_HAS_LONG_LONG) &&\
+ ((defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX)) ||\
+ (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX)) ||\
+ (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX)) ||\
+ (defined(_ULLONG_MAX) && (_ULLONG_MAX != ULONG_MAX)))
+ template <> struct exact_signed_base_helper<sizeof(boost::long_long_type)* CHAR_BIT> { typedef boost::long_long_type exact; };
+ template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
+#endif
+
+
+ } // namespace detail
// integer templates specifying number of bits ---------------------------//
// signed
template< int Bits > // bits (including sign) required
- struct int_t
+ struct int_t : public detail::exact_signed_base_helper<Bits>
{
- typedef typename int_least_helper
+ typedef typename detail::int_least_helper
<
- (Bits-1 <= std::numeric_limits<long>::digits) +
- (Bits-1 <= std::numeric_limits<int>::digits) +
- (Bits-1 <= std::numeric_limits<short>::digits) +
- (Bits-1 <= std::numeric_limits<signed char>::digits)
+#ifdef BOOST_HAS_LONG_LONG
+ (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
+#else
+ 1 +
+#endif
+ (Bits-1 <= ::std::numeric_limits<long>::digits) +
+ (Bits-1 <= ::std::numeric_limits<int>::digits) +
+ (Bits-1 <= ::std::numeric_limits<short>::digits) +
+ (Bits-1 <= ::std::numeric_limits<signed char>::digits)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
};
// unsigned
template< int Bits > // bits required
- struct uint_t
+ struct uint_t : public detail::exact_unsigned_base_helper<Bits>
{
- typedef typename int_least_helper
+#if (defined(__BORLANDC__) || defined(__CODEGEAR__)) && defined(BOOST_NO_INTEGRAL_INT64_T)
+ // It's really not clear why this workaround should be needed... shrug I guess! JM
+ BOOST_STATIC_CONSTANT(int, s =
+ 6 +
+ (Bits <= ::std::numeric_limits<unsigned long>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned int>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned short>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned char>::digits));
+ typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
+#else
+ typedef typename detail::int_least_helper
<
5 +
- (Bits <= std::numeric_limits<unsigned long>::digits) +
- (Bits <= std::numeric_limits<unsigned int>::digits) +
- (Bits <= std::numeric_limits<unsigned short>::digits) +
- (Bits <= std::numeric_limits<unsigned char>::digits)
+#ifdef BOOST_HAS_LONG_LONG
+ (Bits-1 <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
+#else
+ 1 +
+#endif
+ (Bits <= ::std::numeric_limits<unsigned long>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned int>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned short>::digits) +
+ (Bits <= ::std::numeric_limits<unsigned char>::digits)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+#endif
+ typedef typename int_fast_t<least>::type fast;
// int_fast_t<> works correctly for unsigned too, in spite of the name.
};
// integer templates specifying extreme value ----------------------------//
// signed
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::long_long_type MaxValue > // maximum value to require support
+#else
template< long MaxValue > // maximum value to require support
+#endif
struct int_max_value_t
{
- typedef typename int_least_helper
+ typedef typename detail::int_least_helper
<
- (MaxValue <= integer_traits<long>::const_max) +
- (MaxValue <= integer_traits<int>::const_max) +
- (MaxValue <= integer_traits<short>::const_max) +
- (MaxValue <= integer_traits<signed char>::const_max)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ (MaxValue <= ::boost::integer_traits<boost::long_long_type>::const_max) +
+#else
+ 1 +
+#endif
+ (MaxValue <= ::boost::integer_traits<long>::const_max) +
+ (MaxValue <= ::boost::integer_traits<int>::const_max) +
+ (MaxValue <= ::boost::integer_traits<short>::const_max) +
+ (MaxValue <= ::boost::integer_traits<signed char>::const_max)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
};
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::long_long_type MinValue > // minimum value to require support
+#else
template< long MinValue > // minimum value to require support
+#endif
struct int_min_value_t
{
- typedef typename int_least_helper
+ typedef typename detail::int_least_helper
<
- (MinValue >= integer_traits<long>::const_min) +
- (MinValue >= integer_traits<int>::const_min) +
- (MinValue >= integer_traits<short>::const_min) +
- (MinValue >= integer_traits<signed char>::const_min)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ (MinValue >= ::boost::integer_traits<boost::long_long_type>::const_min) +
+#else
+ 1 +
+#endif
+ (MinValue >= ::boost::integer_traits<long>::const_min) +
+ (MinValue >= ::boost::integer_traits<int>::const_min) +
+ (MinValue >= ::boost::integer_traits<short>::const_min) +
+ (MinValue >= ::boost::integer_traits<signed char>::const_min)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+ typedef typename int_fast_t<least>::type fast;
};
// unsigned
- template< unsigned long Value > // maximum value to require support
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::ulong_long_type MaxValue > // minimum value to require support
+#else
+ template< unsigned long MaxValue > // minimum value to require support
+#endif
struct uint_value_t
{
- typedef typename int_least_helper
+#if (defined(__BORLANDC__) || defined(__CODEGEAR__))
+ // It's really not clear why this workaround should be needed... shrug I guess! JM
+#if defined(BOOST_NO_INTEGRAL_INT64_T)
+ BOOST_STATIC_CONSTANT(unsigned, which =
+ 6 +
+ (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
+ typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
+#else // BOOST_NO_INTEGRAL_INT64_T
+ BOOST_STATIC_CONSTANT(unsigned, which =
+ 5 +
+ (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned char>::const_max));
+ typedef typename detail::int_least_helper< ::boost::uint_value_t<MaxValue>::which>::least least;
+#endif // BOOST_NO_INTEGRAL_INT64_T
+#else
+ typedef typename detail::int_least_helper
<
5 +
- (Value <= integer_traits<unsigned long>::const_max) +
- (Value <= integer_traits<unsigned int>::const_max) +
- (Value <= integer_traits<unsigned short>::const_max) +
- (Value <= integer_traits<unsigned char>::const_max)
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ (MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
+#else
+ 1 +
+#endif
+ (MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned short>::const_max) +
+ (MaxValue <= ::boost::integer_traits<unsigned char>::const_max)
>::least least;
- typedef typename int_fast_t<least>::fast fast;
+#endif
+ typedef typename int_fast_t<least>::type fast;
};
Modified: branches/release/boost/integer/integer_mask.hpp
==============================================================================
--- branches/release/boost/integer/integer_mask.hpp (original)
+++ branches/release/boost/integer/integer_mask.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -70,6 +70,11 @@
BOOST_STATIC_CONSTANT( std::size_t, bit_count = limits_type::digits ); \
}
+#ifdef BOOST_MSVC
+#pragma warning(push)
+#pragma warning(disable:4245) // 'initializing' : conversion from 'int' to 'const boost::low_bits_mask_t<8>::least', signed/unsigned mismatch
+#endif
+
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned char );
#if USHRT_MAX > UCHAR_MAX
@@ -84,6 +89,10 @@
BOOST_LOW_BITS_MASK_SPECIALIZE( unsigned long );
#endif
+#ifdef BOOST_MSVC
+#pragma warning(pop)
+#endif
+
#undef BOOST_LOW_BITS_MASK_SPECIALIZE
Modified: branches/release/boost/integer/static_log2.hpp
==============================================================================
--- branches/release/boost/integer/static_log2.hpp (original)
+++ branches/release/boost/integer/static_log2.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -16,7 +16,7 @@
#ifndef BOOST_INTEGER_STATIC_LOG2_HPP
#define BOOST_INTEGER_STATIC_LOG2_HPP
-#include "boost/config.hpp" // for BOOST_STATIC_CONSTANT
+#include "boost/integer_fwd.hpp" // for boost::intmax_t
namespace boost {
@@ -41,9 +41,8 @@
// terminates with x = 1 and n = 0 (see the algorithm's
// invariant).
- typedef unsigned long argument_type;
- typedef int result_type;
-
+ typedef boost::static_log2_argument_type argument_type;
+ typedef boost::static_log2_result_type result_type;
template <result_type n>
struct choose_initial_n {
@@ -107,10 +106,6 @@
// static_log2<x>
// ----------------------------------------
- typedef detail::static_log2_impl::argument_type static_log2_argument_type;
- typedef detail::static_log2_impl::result_type static_log2_result_type;
-
-
template <static_log2_argument_type x>
struct static_log2 {
Modified: branches/release/boost/integer/static_min_max.hpp
==============================================================================
--- branches/release/boost/integer/static_min_max.hpp (original)
+++ branches/release/boost/integer/static_min_max.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -12,39 +12,35 @@
#include <boost/integer_fwd.hpp> // self include
-#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT
-
-
namespace boost
{
-
// Compile-time extrema class declarations ---------------------------------//
// Get the minimum or maximum of two values, signed or unsigned.
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_min
{
- BOOST_STATIC_CONSTANT( long, value = (Value1 > Value2) ? Value2 : Value1 );
+ BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 > Value2) ? Value2 : Value1 );
};
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_max
{
- BOOST_STATIC_CONSTANT( long, value = (Value1 < Value2) ? Value2 : Value1 );
+ BOOST_STATIC_CONSTANT(static_min_max_signed_type, value = (Value1 < Value2) ? Value2 : Value1 );
};
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_min
{
- BOOST_STATIC_CONSTANT( unsigned long, value
+ BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
= (Value1 > Value2) ? Value2 : Value1 );
};
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max
{
- BOOST_STATIC_CONSTANT( unsigned long, value
+ BOOST_STATIC_CONSTANT(static_min_max_unsigned_type, value
= (Value1 < Value2) ? Value2 : Value1 );
};
Modified: branches/release/boost/integer_fwd.hpp
==============================================================================
--- branches/release/boost/integer_fwd.hpp (original)
+++ branches/release/boost/integer_fwd.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -14,11 +14,23 @@
#include <boost/config.hpp> // for BOOST_NO_INTRINSIC_WCHAR_T
#include <boost/limits.hpp> // for std::numeric_limits
+#include <boost/cstdint.hpp> // For intmax_t
namespace boost
{
+#ifdef BOOST_NO_INTEGRAL_INT64_T
+ typedef unsigned long static_log2_argument_type;
+ typedef int static_log2_result_type;
+ typedef long static_min_max_signed_type;
+ typedef unsigned long static_min_max_unsigned_type;
+#else
+ typedef boost::uintmax_t static_min_max_unsigned_type;
+ typedef boost::intmax_t static_min_max_signed_type;
+ typedef boost::uintmax_t static_log2_argument_type;
+ typedef int static_log2_result_type;
+#endif
// From <boost/cstdint.hpp> ------------------------------------------------//
@@ -65,7 +77,7 @@
template < >
class integer_traits< unsigned long >;
-#ifdef ULLONG_MAX
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && !defined(BOOST_NO_INT64_T) && (defined(BOOST_HAS_LONG_LONG) || defined(BOOST_HAS_MS_INT64))
template < >
class integer_traits< ::boost::long_long_type>;
@@ -85,13 +97,25 @@
template< int Bits >
struct uint_t;
-template< long MaxValue >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::long_long_type MaxValue > // maximum value to require support
+#else
+ template< long MaxValue > // maximum value to require support
+#endif
struct int_max_value_t;
-template< long MinValue >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::long_long_type MinValue > // minimum value to require support
+#else
+ template< long MinValue > // minimum value to require support
+#endif
struct int_min_value_t;
-template< unsigned long Value >
+#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
+ template< boost::ulong_long_type MaxValue > // maximum value to require support
+#else
+ template< unsigned long MaxValue > // maximum value to require support
+#endif
struct uint_value_t;
@@ -124,28 +148,26 @@
// From <boost/integer/static_log2.hpp> ------------------------------------//
-template < unsigned long Value >
+template <static_log2_argument_type Value >
struct static_log2;
-template < >
- struct static_log2< 0ul >;
+template <> struct static_log2<0u>;
// From <boost/integer/static_min_max.hpp> ---------------------------------//
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_min;
-template < long Value1, long Value2 >
+template <static_min_max_signed_type Value1, static_min_max_signed_type Value2>
struct static_signed_max;
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_min;
-template < unsigned long Value1, unsigned long Value2 >
+template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max;
-
} // namespace boost
Modified: branches/release/boost/integer_traits.hpp
==============================================================================
--- branches/release/boost/integer_traits.hpp (original)
+++ branches/release/boost/integer_traits.hpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -27,6 +27,17 @@
#include <wchar.h>
#endif
+//
+// We simply cannot include this header on gcc without getting copious warnings of the kind:
+//
+// ../../../boost/integer_traits.hpp:164:66: warning: use of C99 long long integer constant
+//
+// And yet there is no other reasonable implementation, so we declare this a system header
+// to suppress these warnings.
+//
+#if defined(__GNUC__) && (__GNUC__ >= 4)
+#pragma GCC system_header
+#endif
namespace boost {
template<class T>
@@ -225,6 +236,20 @@
public detail::integer_traits_base< ::boost::ulong_long_type, 0, ~0uLL>
{ };
+#elif defined(BOOST_HAS_MS_INT64)
+
+template<>
+class integer_traits< __int64>
+ : public std::numeric_limits< __int64>,
+ public detail::integer_traits_base< __int64, _I64_MIN, _I64_MAX>
+{ };
+
+template<>
+class integer_traits< unsigned __int64>
+ : public std::numeric_limits< unsigned __int64>,
+ public detail::integer_traits_base< unsigned __int64, 0, _UI64_MAX>
+{ };
+
#endif
#endif
Deleted: branches/release/libs/integer/cstdint.htm
==============================================================================
--- branches/release/libs/integer/cstdint.htm 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,81 +0,0 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=windows-1252">
-<meta name="GENERATOR" content="Microsoft FrontPage 5.0">
-<meta name="ProgId" content="FrontPage.Editor.Document">
-<title>Header boost/cstdint.hpp</title>
-</head>
-
-<body bgcolor="#FFFFFF" text="#000000">
-
-<h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">Header
-boost/cstdint.hpp </h1>
-<p>The header <code><boost/cstdint.hpp></code>
-provides the typedef's useful for
-writing portable code that requires certain integer widths. All typedef's are in namespace boost.</p>
-<p>The specifications are based on the ISO/IEC 9899:1999 C Language standard
-header <stdint.h>. The 64-bit types required by the C standard are not
-required in the boost header, and may not be supplied in all implementations,
-because <code>long long</code> is not [yet] included in the C++ standard.</p>
-<p>See cstdint_test.cpp for a test program.</p>
-<h2>Exact-width integer types</h2>
-<p>The typedef <code>int#_t</code>, with # replaced by the width, designates a
-signed integer type of exactly # bits; <code>int8_t</code> denotes an 8-bit
-signed integer type. Similarly, the typedef <code>uint#_t</code>
-designates and unsigned integer type of exactly # bits.</p>
-<p>These types are optional. However, if an implementation provides integer
-types with widths of 8, 16, 32, or 64 bits, it shall define the corresponding
-typedef names.</p>
-<h2>Minimum-width integer types</h2>
-<p>The typedef <code>int_least#_t</code>, with # replaced by the width,
-designates a signed integer type with a width of at least # bits, such that no
-signed integer type with lesser size has at least the specified width. Thus, <code>int_least32_t</code>
-denotes a signed integer type with a width of at least 32 bits. Similarly, the
-typedef name <code>uint_least#_t</code> designates an unsigned integer type with
-a width of at least # bits, such that no unsigned integer type with lesser size
-has at least the specified width.</p>
-<p>Required minimum-width integer types:</p>
-<ul>
- <li><code>int_least8_t</code></li>
- <li><code>int_least16_t</code></li>
- <li><code>int_least32_t</code></li>
- <li><code>uint_least8_t</code></li>
- <li><code>uint_least16_t</code></li>
- <li><code>uint_least32_t</code></li>
-</ul>
-<p>All other minimum-width integer types are optional.</p>
-<h2>Fastest minimum-width integer types</h2>
-<p>The typedef <code>int_fast#_t</code>, with # replaced by the width,
-designates the fastest signed integer type with a width of at least # bits.
-Similarly, the typedef name <code>uint_fast#_t</code> designates the fastest
-unsigned integer type with a width of at least # bits.</p>
-<p>There is no guarantee that these types are fastest for all purposes. In
-any case, however, they satisfy the signedness and width requirements.</p>
-<p>Required fastest minimum-width integer types:</p>
-<ul>
- <li><code>int_fast8_t</code></li>
- <li><code>int_fast16_t</code></li>
- <li><code>int_fast32_t</code></li>
- <li><code>uint_fast8_t</code></li>
- <li><code>uint_fast16_t</code></li>
- <li><code>uint_fast32_t</code></li>
-</ul>
-<p>All other fastest minimum-width integer types are optional.</p>
-<h2>Greatest-width integer types</h2>
-<p>The typedef <code>intmax_t </code>designates a signed integer type capable of
-representing any value of any signed integer type.</p>
-<p>The typedef <code>uintmax_t</code> designates an unsigned integer type
-capable of representing any value of any unsigned integer type.</p>
-<p>These types are required.</p>
-<hr>
-<p>Revised <!--webbot bot="Timestamp" s-type="EDITED" s-format="%d %b %Y" startspan -->06 Nov 2007<!--webbot bot="Timestamp" endspan i-checksum="15272" -->
-</p>
-<p>© Copyright Beman Dawes 2000</p>
-
-<p>Distributed under the Boost Software License, Version 1.0. See
-www.boost.org/LICENSE_1_0.txt</p>
-
-</body>
-
-</html>
\ No newline at end of file
Deleted: branches/release/libs/integer/doc/integer_mask.html
==============================================================================
--- branches/release/libs/integer/doc/integer_mask.html 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,210 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<title>Integer Bit Mask Templates</title>
-</head>
-
-<body bgcolor="white" text="black" link="blue" vlink="purple" alink="red">
-<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)"
-align="middle" width="277" height="86">Integer Bit Mask Templates</h1>
-
-<p>The class templates in <cite><boost/integer/integer_mask.hpp></cite> provide bit masks for a certain bit position or a contiguous-bit pack of a certain size. The types of the masking constants come from the integer type selection templates header.</p>
-
-<h2><a name="contents">Contents</a></h2>
-
-<ul>
- <li>Contents</li>
- <li>Synopsis</li>
- <li>Single Bit-Mask Class Template</li>
- <li>Group Bit-Mask Class Template</li>
- <li>Example</li>
- <li>Demonstration Program</li>
- <li>Rationale</li>
- <li>Credits</li>
-</ul>
-
-<h2><a name="synopsis">Synopsis</a></h2>
-
-<blockquote><pre>
-#include <cstddef> <i>// for std::size_t</i>
-
-namespace boost
-{
-
-template < std::size_t Bit >
-struct high_bit_mask_t
-{
- typedef <em>implementation_supplied</em> least;
- typedef <em>implementation_supplied</em> fast;
-
- static const least high_bit = <em>implementation_defined</em>;
- static const fast high_bit_fast = <em>implementation_defined</em>;
-
- static const std::size_t bit_position = Bit;
-
-};
-
-template < std::size_t Bits >
-struct low_bits_mask_t
-{
- typedef <em>implementation_supplied</em> least;
- typedef <em>implementation_supplied</em> fast;
-
- static const least sig_bits = <em>implementation_defined</em>;
- static const fast sig_bits_fast = <em>implementation_defined</em>;
-
- static const std::size_t bit_count = Bits;
-
-};
-
-// Specializations for low_bits_mask_t exist for certain bit counts.
-
-} // namespace boost
-</pre></blockquote>
-
-<h2><a name="single">Single Bit-Mask Class Template</a></h2>
-
-<p>The <code>boost::high_bit_mask_t</code> class template provides
-constants for bit masks representing the bit at a certain position. The
-masks are equivalent to the value 2<sup><code>Bit</code></sup>, where
-<code>Bit</code> is the template parameter. The bit position must be a
-nonnegative number from zero to <i>Max</i>, where <dfn>Max</dfn> is one
-less than the number of bits supported by the largest unsigned built-in
-integral type. The following table describes the members of an
-instantiation of <code>high_bit_mask_t</code>.</p>
-
-<table border="1" cellpadding="5">
- <caption>Members of the <code>boost::high_bit_mask_t</code> Class
- Template</caption>
- <tr>
- <th>Member</th>
- <th>Meaning</th>
- </tr>
- <tr>
- <td><code>least</code></td>
- <td>The smallest unsigned built-in type that supports the given
- bit position.</td>
- </tr>
- <tr>
- <td><code>fast</code></td>
- <td>The quick-to-manipulate analog of <code>least</code>.</td>
- </tr>
- <tr>
- <td><code>high_bit</code></td>
- <td>A <code>least</code> constant of the desired bit-masking
- value.</td>
- </tr>
- <tr>
- <td><code>high_bit_fast</code></td>
- <td>A <code>fast</code> analog of <code>high_bit</code>.</td>
- </tr>
- <tr>
- <td><code>bit_position</code></td>
- <td>The value of the template parameter, in case its needed from
- a renamed instantiation of the class template.</td>
- </tr>
-</table>
-
-<h2><a name="group">Group Bit-Mask Class Template</a></h2>
-
-<p>The <code>boost::low_bits_mask_t</code> class template provides
-constants for bit masks representing the lowest bits of a certain
-amount. The masks are equivalent to the value
-(2<sup><code>Bits</code></sup> - 1), where <code>Bits</code> is the
-template parameter. The bit amount must be a nonnegative number from
-zero to <i>Max</i>, where <dfn>Max</dfn> is the number of bits supported
-by the largest unsigned built-in integral type. The following table
-describes the members of an instantiation of
-<code>low_bits_mask_t</code>.</p>
-
-<table border="1" cellpadding="5">
- <caption>Members of the <code>boost::low_bits_mask_t</code> Class
- Template</caption>
- <tr>
- <th>Member</th>
- <th>Meaning</th>
- </tr>
- <tr>
- <td><code>least</code></td>
- <td>The smallest unsigned built-in type that supports the given
- bit count.</td>
- </tr>
- <tr>
- <td><code>fast</code></td>
- <td>The quick-to-manipulate analog of <code>least</code>.</td>
- </tr>
- <tr>
- <td><code>sig_bits</code></td>
- <td>A <code>least</code> constant of the desired bit-masking
- value.</td>
- </tr>
- <tr>
- <td><code>sig_bits_fast</code></td>
- <td>A <code>fast</code> analog of <code>sig_bits</code>.</td>
- </tr>
- <tr>
- <td><code>bit_count</code></td>
- <td>The value of the template parameter, in case its needed from
- a renamed instantiation of the class template.</td>
- </tr>
-</table>
-
-<p><strong>Implementation Note</strong><br>
-When <code>Bits</code> is the exact size of a built-in unsigned type,
-the implementation has to change to prevent undefined behavior.
-Therefore, there are specializations of <code>low_bits_mask_t</code> at
-those bit counts.</p>
-
-<h2><a name="example">Example</a></h2>
-
-<blockquote><pre>
-#include <boost/integer/integer_mask.hpp>
-
-//...
-
-int main()
-{
- typedef boost::high_bit_mask_t<29> mask1_type;
- typedef boost::low_bits_mask_t<15> mask2_type;
-
- mask1_type::least my_var1;
- mask2_type::fast my_var2;
- //...
-
- my_var1 |= mask1_type::high_bit;
- my_var2 &= mask2_type::sig_bits_fast;
-
- //...
-}
-</pre></blockquote>
-
-<h2><a name="demo">Demonstration Program</a></h2>
-
-<p>The program integer_mask_test.cpp
-is a simplistic demonstration of the results from instantiating various
-examples of the bit mask class templates.</p>
-
-<h2><a name="rationale">Rationale</a></h2>
-
-<p>The class templates in this header are an extension of the <a
-href="../integer.htm">integer type selection class templates</a>. The new
-class templates provide the same sized types, but also convienent masks
-to use when extracting the highest or all the significant bits when the
-containing built-in type contains more bits. This prevents
-contaimination of values by the higher, unused bits.</p>
-
-<h2><a name="credits">Credits</a></h2>
-
-<p>The author of the Boost bit mask class templates is <a
-href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>.</p>
-
-<hr>
-
-<p>Revised September 23, 2001</p>
-
-<p>© Copyright Daryle Walker 2001. Use, modification, and distribution are
-subject to the Boost Software License, Version 1.0. (See accompanying file <a
-href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
-href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>>.)</p>
-</body>
-</html>
Deleted: branches/release/libs/integer/doc/static_log2.html
==============================================================================
--- branches/release/libs/integer/doc/static_log2.html 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,215 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-
-<html>
-
-<head>
-
-<title>Binary Logarithm Template</title>
-
-</head>
-
-
-
-<body bgcolor="white" text="black">
-
-<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)"
-align="middle" width="277" height="86">Binary Logarithm Template</h1>
-
-
-<p>The class template in <cite><boost/integer/static_log2.hpp></cite> determines the position of the highest bit in a given value. This facility is useful for solving generic programming problems.</p>
-
-
-
-<h2><a name="contents">Contents</a></h2>
-
-
-<ul>
-
- <li>Contents</li>
-
- <li>Synopsis</li>
-
- <li>Usage</li>
-
- <li>Example</li>
-
- <li>Demonstration Program</li>
-
- <li>Rationale</li>
-
- <li>Credits</li>
-
- <li>What's new</li>
-
-</ul>
-
-
-
-<h2><a name="synopsis">Synopsis</a></h2>
-
-
-
-<blockquote><pre>
-
-namespace boost
-{
-
- typedef <em>implementation-defined</em> static_log2_argument_type;
- typedef <em>implementation-defined</em> static_log2_result_type;
-
- template < static_log2_argument_type arg >
- struct static_log2
- {
- static const static_log2_result_type value = <em>implementation-defined</em>;
- };
-
-
- template < >
- struct static_log2< 0 >
- {
- // The logarithm of zero is undefined.
- };
-
-
-} // namespace boost
-
-</pre></blockquote>
-
-
-
-
-<h2><a name="usage">Usage</a></h2>
-
-
-
-<p>The <code>boost::static_log2</code> class template takes one template
-parameter, a value of type <code>static_log2_argument_type</code>. The template
-only defines one member, <code>value</code>, which gives the truncated
-base-two logarithm of the template argument.</p>
-
-<p>Since the logarithm of zero, for any base, is undefined, there is a
-specialization of <code>static_log2</code> for a template argument
-of zero. This specialization has no members, so an attempt to use
-the base-two logarithm of zero results in a compile-time error.</p>
-
-<p>Note: <ul>
-
- <li><code>static_log2_argument_type</code> is an <i>unsigned integer
- type</i> (C++ standard, 3.9.1p3).</li>
-
- <li><code>static_log2_result_type</code> is an <i>integer type</i>
- (C++ standard, 3.9.1p7).</li>
-
- </ul>
-
-
-
-<h2><a name="example">Example</a></h2>
-
-
-
-<blockquote><pre>
-
-#include "boost/integer/static_log2.hpp"
-
-
-template < boost::static_log2_argument_type value >
-bool is_it_what()
-{
- typedef boost::static_log2<value> lb_type;
-
- int temp = lb_type::value;
- //...
- return (temp % 2) != 0;
-}
-
-//...
-
-int main()
-{
- bool temp = is_it_what<2000>();
- //...
-# if 0
- temp = is_it_what<0>(); // would give an error
-# endif
- //...
- temp = is_it_what<24>();
- //...
-}
-
-</pre></blockquote>
-
-
-
-<h2><a name="demo">Demonstration Program</a></h2>
-
-
-
-<p>The program static_log2_test.cpp
-is a simplistic demonstration of the results from instantiating various
-examples of the binary logarithm class template.</p>
-
-
-
-<h2><a name="rationale">Rationale</a></h2>
-
-
-
-<p>The base-two (binary) logarithm, abbreviated <dfn>lb</dfn>, function
-is occasionally used to give order-estimates of computer algorithms.
-The truncated logarithm can be considered the highest power-of-two in a
-value, which corresponds to the value's highest set bit (for binary
-integers). Sometimes the highest-bit position could be used in generic
-programming, which requires the position to be statically (<i>i.e.</i>
-at compile-time) available.</p>
-
-
-
-<h2><a name="whatsnew">Changes from previous versions:</a></h2>
-
-
-
-<ul>
-<li><i>New in version 1.32.0:</i><br><br>
-
-The argument type and the result type of <code>boost::static_log2</code>
-are now typedef'd. Formerly, they were hardcoded as <code>unsigned long</code>
-and <code>int</code> respectively. Please, use the provided typedefs in new
-code (and update old code as soon as possible).
-</li>
-</ul>
-
-
-
-<h2><a name="credits">Credits</a></h2>
-
-
-
-<p>The original version of the Boost binary logarithm class template was
-written by Daryle Walker
-and then enhanced by Giovanni Bajo with support for compilers without
-partial template specialization. The current version was suggested,
-together with a reference implementation, by Vesa Karvonen. Gennaro Prota
-wrote the actual source file.
-</p>
-
-<hr>
-
-
-
-<p>Revised July 19, 2004</p>
-
- <p>© Copyright Daryle Walker 2001.<br>
- © Copyright Gennaro Prota 2004.</p>
-
- Distributed under the Boost Software License, Version 1.0.
- (See accompanying file LICENSE_1_0.txt or copy at
- <a href="http://www.boost.org/LICENSE_1_0.txt">
- http://www.boost.org/LICENSE_1_0.txt>)
-
-<br>
-
-</body>
-
-</html>
-
Deleted: branches/release/libs/integer/doc/static_min_max.html
==============================================================================
--- branches/release/libs/integer/doc/static_min_max.html 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,120 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<title>Compile-Time Extrema Templates</title>
-</head>
-
-<body bgcolor="white" text="black" link="blue" alink="red" vlink="purple">
-<h1><img src="../../../boost.png" alt="boost.png (6897 bytes)"
-align="middle" width="277" height="86">Compile-Time Extrema
-Templates</h1>
-
-<p>The class templates in <cite><a
-href="../../../boost/integer/static_min_max.hpp"><boost/integer/static_min_max.hpp></a></cite>
-provide a compile-time evaluation of the minimum or maximum of
-two integers. These facilities are useful for generic programming problems.</p>
-
-<h2><a name="contents">Contents</a></h2>
-
-<ul>
- <li>Contents</li>
- <li>Synopsis</li>
- <li>Usage</li>
- <li>Example</li>
- <li>Demonstration Program</li>
- <li>Rationale</li>
- <li>Credits</li>
-</ul>
-
-<h2><a name="synopsis">Synopsis</a></h2>
-
-<blockquote><pre>
-namespace boost
-{
-
-template < long Value1, long Value2 >
- struct static_signed_min;
-
-template < long Value1, long Value2 >
- struct static_signed_max;
-
-template < unsigned long Value1, unsigned long Value2 >
- struct static_unsigned_min;
-
-template < unsigned long Value1, unsigned long Value2 >
- struct static_unsigned_max;
-
-}
-</pre></blockquote>
-
-<h2><a name="usage">Usage</a></h2>
-
-<p>The four class templates provide the combinations for finding the
-minimum or maximum of two signed or <code>unsigned</code>
-(<code>long</code>) parameters, <var>Value1</var> and <var>Value2</var>,
-at compile-time. Each template has a single static data member,
-<code>value</code>, which is set to the respective minimum or maximum
-of the template's parameters.</p>
-
-<h2><a name="example">Example</a></h2>
-
-<blockquote><pre>
-#include <boost/integer/static_min_max.hpp>
-
-template < unsigned long AddendSize1, unsigned long AddendSize2 >
-class adder
-{
-public:
- static unsigned long const addend1_size = AddendSize1;
- static unsigned long const addend2_size = AddendSize2;
- static unsigned long const sum_size = boost::static_unsigned_max<AddendSize1, AddendSize2>::value + 1;
-
- typedef int addend1_type[ addend1_size ];
- typedef int addend2_type[ addend2_size ];
- typedef int sum_type[ sum_size ];
-
- void operator ()( addend1_type const &a1, addend2_type const &a2, sum_type &s ) const;
-};
-
-//...
-
-int main()
-{
- int const a1[] = { 0, 4, 3 }; // 340
- int const a2[] = { 9, 8 }; // 89
- int s[ 4 ];
- adder<3,2> obj;
-
- obj( a1, a2, s ); // 's' should be 429 or { 9, 2, 4, 0 }
- //...
-}
-</pre></blockquote>
-
-<h2><a name="demo">Demonstration Program</a></h2>
-
-<p>The program <a
-href="../test/static_min_max_test.cpp">static_min_max_test.cpp</a> is a
-simplistic demonstration of various comparisons using the compile-time
-extrema class templates.</p>
-
-<h2><a name="rationale">Rationale</a></h2>
-
-<p>Sometimes the minimum or maximum of several values needs to be found
-for later compile-time processing, <i>e.g.</i> for a bound for another
-class template.</p>
-
-<h2><a name="credits">Credits</a></h2>
-
-<p>The author of the Boost compile-time extrema class templates is <a
-href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a>.</p>
-
-<hr>
-
-<p>Revised October 12, 2001</p>
-
-<p>© Copyright Daryle Walker 2001. Use, modification, and distribution are
-subject to the Boost Software License, Version 1.0. (See accompanying file <a
-href="../../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
-href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>>.)</p>
-</body>
-</html>
Modified: branches/release/libs/integer/index.html
==============================================================================
--- branches/release/libs/integer/index.html (original)
+++ branches/release/libs/integer/index.html 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -1,133 +1,16 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
<html>
<head>
-<title>Boost Integer Library</title>
+<meta http-equiv="refresh" content="0; URL=doc/html/index.html">
</head>
+<body>
+Automatic redirection failed, please go to
+doc/html/index.html.
+ <P>Copyright Beman Dawes, Daryle Walker, Gennaro Prota and John Maddock 2001-2009</P>
+ <P>Distributed under the Boost Software License, Version 1.0. (See accompanying file <A href="../../LICENSE_1_0.txt">
+ LICENSE_1_0.txt</A> or copy at www.boost.org/LICENSE_1_0.txt).</P>
+</body>
+</html>
-<body bgcolor="white" text="black">
-<table border="1" bgcolor="teal" cellpadding="2">
- <tr>
- <td bgcolor="white"><img src="../../boost.png" alt="boost.png (6897 bytes)" width="277" height="86"></td>
- <td>Home</td>
- <td>Libraries</td>
- <td>People</td>
- <td>FAQ</td>
- <td>More</td>
- </tr>
-</table>
-
-<h1>Boost Integer Library</h1>
-
-<table border="1" cellpadding="5">
- <tr>
- <th>Header / Docs</th>
- <th>Contents</th>
- <th>Use</th>
- </tr>
- <tr>
- <td align="center"><cite><boost/integer_fwd.hpp></cite></td>
- <td valign="top">Forward declarations of classes and class templates</td>
- <td valign="top">When just the name of a class is needed</td>
- </tr>
- <tr>
- <td align="center"><code><a href="../../boost/cstdint.hpp"><boost/cstdint.hpp><br>
- </a></code><a href="cstdint.htm"><br>
- documentation</a>
- </td>
- <td valign="top">Typedef's based on the 1999 C Standard header <<code>stdint.h></code>, wrapped in namespace boost.
- This implementation may #include the compiler
- supplied <<code>stdint.h></code>, if present. </td>
- <td valign="top">Supplies typedefs for standard integer types such as <code> int32_t</code> or <code>uint_least16_t</code>.
- Use in preference to <<code>stdint.h></code>
- for enhanced portability. Furthermore, all names are safely placed in the boost namespace.</td>
- </tr>
- <tr>
- <td align="center"><code><boost/integer_traits.hpp></code><br>
- <br>
- documentation
- </td>
- <td valign="top">Template class <code>boost::integer_traits</code>, derived from <code>std::numeric_limits</code>.
- Adds <code>const_min</code> and <code>const_max</code> members.</td>
- <td valign="top">Use to obtain the characteristics of a known integer type.</td>
- </tr>
- <tr>
- <td align="center"><code><boost/integer.hpp><br>
- <br>
- </code>documentation</td>
- <td valign="top">Templates for integer type selection based on properties such as
- maximum value or number of bits.</td>
- <td valign="top">Use to select the type an integer when some property such as maximum value or number of bits is known.
- Useful for generic programming. </td>
- </tr>
- <tr>
- <td align="center"><code><boost/integer/integer_mask.hpp><br>
- <br>
- </code>documentation</td>
- <td valign="top">Templates for the selection of integer masks, single or lowest group, based on the number of bits.</td>
- <td valign="top">Use to select a particular mask when the bit position(s) are based on a compile-time variable.
- Useful for generic programming. </td>
- </tr>
- <tr>
- <td align="center"><code><boost/integer/static_log2.hpp><br>
- <br>
- </code>documentation</td>
- <td valign="top">Template for finding the highest power of two in a number.</td>
- <td valign="top">Use to find the bit-size/range based on a maximum value.
- Useful for generic programming. </td>
- </tr>
- <tr>
- <td align="center"><code><boost/integer/static_min_max.hpp><br>
- <br>
- </code>documentation</td>
- <td valign="top">Templates for finding the extrema of two numbers.</td>
- <td valign="top">Use to find a bound based on a minimum or maximum value.
- Useful for generic programming. </td>
- </tr>
-</table>
-
-<h2>Rationale</h2>
-
-<p>The organization of boost integer headers and classes is designed to
-take advantage of <cite><stdint.h></cite> types from the 1999 C
-standard without resorting to undefined behavior in terms of the 1998
-C++ standard. The header <cite><boost/cstdint.hpp></cite> makes
-the standard integer types safely available in namespace
-<code>boost</code> without placing any names in namespace
-<code>std</code>. As always, the intension is to complement rather than
-compete with the C++ Standard Library. Should some future C++ standard
-include <cite><stdint.h></cite> and <cite><cstdint></cite>,
-then <cite><boost/cstdint.hpp></cite> will continue to function,
-but will become redundant and may be safely deprecated.</p>
-
-<p>Because these are boost headers, their names conform to boost header
-naming conventions rather than C++ Standard Library header naming
-conventions.</p>
-
-<h2><i>Caveat emptor</i></h2>
-
-<p>As an implementation artifact, certain C
-<cite><limits.h></cite> macro names may possibly be visible to
-users of <cite><boost/cstdint.hpp></cite>. Don't use these
-macros; they are not part of any Boost-specified interface. Use
-<code>boost::integer_traits<></code> or
-<code>std::numeric_limits<></code> instead.</p>
-
-<p>As another implementation artifact, certain C
-<cite><stdint.h></cite> typedef names may possibly be visible in
-the global namespace to users of <cite><boost/cstdint.hpp></cite>.
- Don't use these names, they are not part of any Boost-specified
-interface. Use the respective names in namespace <code>boost</code>
-instead.</p>
-
-<hr>
-
-<p>Revised: <!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %b %Y" startspan -->06 Nov 2007<!--webbot bot="Timestamp" endspan i-checksum="15272" -->
-</p>
-<p>© Copyright Beman Dawes 2003</p>
-<p>Distributed under the Boost Software License, Version 1.0. See
-www.boost.org/LICENSE_1_0.txt</p>
-</body>
-</html>
\ No newline at end of file
Deleted: branches/release/libs/integer/integer.htm
==============================================================================
--- branches/release/libs/integer/integer.htm 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,212 +0,0 @@
-<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 3.2//EN">
-<html>
-<head>
-<title>Integer Type Selection Templates</title>
-</head>
-
-<body bgcolor="white" text="black">
-<h1>
-<img src="../../boost.png" alt="boost.png (6897 bytes)"
-align="middle" width="277" height="86">Integer Type Selection
-Templates</h1>
-
-<p>The <cite><a
-href="../../boost/integer.hpp"><boost/integer.hpp></a></cite> type
-selection templates allow integer types to be selected based on desired
-characteristics such as number of bits or maximum value. This facility
-is particularly useful for solving generic programming problems.</p>
-
-<h2><a name="contents">Contents</a></h2>
-
-<ul>
- <li>Contents</li>
- <li>Synopsis</li>
- <li>Easiest-to-Manipulate Types</li>
- <li>Sized Types</li>
- <li>Example</li>
- <li>Demonstration Program</li>
- <li>Rationale</li>
- <li>Alternative</li>
- <li>Credits</li>
-</ul>
-
-<h2><a name="synopsis">Synopsis</a></h2>
-
-<blockquote><pre>namespace boost
-{
- // fast integers from least integers
- template< typename LeastInt >
- struct int_fast_t
- {
- typedef <em>implementation_supplied</em> fast;
- };
-
- // signed
- template< int Bits >
- struct int_t
- {
- typedef <em>implementation_supplied</em> least;
- typedef int_fast_t<least>::fast fast;
- };
-
- // unsigned
- template< int Bits >
- struct uint_t
- {
- typedef <em>implementation_supplied</em> least;
- typedef int_fast_t<least>::fast fast;
- };
-
- // signed
- template< long MaxValue >
- struct int_max_value_t
- {
- typedef <em>implementation_supplied</em> least;
- typedef int_fast_t<least>::fast fast;
- };
-
- template< long MinValue >
- struct int_min_value_t
- {
- typedef <em>implementation_supplied</em> least;
- typedef int_fast_t<least>::fast fast;
- };
-
- // unsigned
- template< unsigned long Value >
- struct uint_value_t
- {
- typedef <em>implementation_supplied</em> least;
- typedef int_fast_t<least>::fast fast;
- };
-} // namespace boost
-</pre></blockquote>
-
-<h2><a name="easy">Easiest-to-Manipulate Types</a></h2>
-
-<p>The <code>int_fast_t</code> class template maps its input type to the
-next-largest type that the processor can manipulate the easiest, or to
-itself if the input type is already an easy-to-manipulate type. For
-instance, processing a bunch of <code>char</code> objects may go faster
-if they were converted to <code>int</code> objects before processing.
-The input type, passed as the only template parameter, must be a
-built-in integral type, except <code>bool</code>. Unsigned integral
-types can be used, as well as signed integral types, despite the name.
-The output type is given as the class member <code>fast</code>.</p>
-
-<p><strong>Implementation Notes</strong><br>
-By default, the output type is identical to the input type. Eventually,
-this code's implementation should be conditionalized for each platform
-to give accurate mappings between the built-in types and the
-easiest-to-manipulate built-in types. Also, there is no guarantee that
-the output type actually is easier to manipulate than the input
-type.</p>
-
-<h2><a name="sized">Sized Types</a></h2>
-
-<p>The <code>int_t</code>, <code>uint_t</code>,
-<code>int_max_value_t</code>, <code>int_min_value_t</code>, and
-<code>uint_value_t</code> class templates find the most appropiate
-built-in integral type for the given template parameter. This type is
-given by the class member <code>least</code>. The easiest-to-manipulate
-version of that type is given by the class member <code>fast</code>.
-The following table describes each template's criteria.</p>
-
-<table border="1" cellpadding="5">
- <caption>Criteria for the Sized Type Class Templates</caption>
- <tr>
- <th>Class Template</th>
- <th>Template Parameter Mapping</th>
- </tr>
- <tr>
- <td><code>boost::int_t</code></td>
- <td>The smallest built-in signed integral type with at least the
- given number of bits, including the sign bit. The parameter
- should be a positive number. A compile-time error results if
- the parameter is larger than the number of bits in a
- <code>long</code>.</td>
- </tr>
- <tr>
- <td><code>boost::uint_t</code></td>
- <td>The smallest built-in unsigned integral type with at least
- the given number of bits. The parameter should be a positive
- number. A compile-time error results if the parameter is
- larger than the number of bits in an <code>unsigned
- long</code>.</td>
- </tr>
- <tr>
- <td><code>boost::int_max_value_t</code></td>
- <td>The smallest built-in signed integral type that supports the
- given value as a maximum. The parameter should be a
- positive number.</td>
- </tr>
- <tr>
- <td><code>boost::int_min_value_t</code></td>
- <td>The smallest built-in signed integral type that supports the
- given value as a minimum. The parameter should be a
- negative number.</td>
- </tr>
- <tr>
- <td><code>boost::uint_value_t</code></td>
- <td>The smallest built-in unsigned integral type that supports
- the given value as a maximum. The parameter should be a
- positive number.</td>
- </tr>
-</table>
-
-<h2><a name="example">Example</a></h2>
-
-<blockquote><pre>#include <boost/integer.hpp>
-
-//...
-
-int main()
-{
- boost::int_t<24>::least my_var;
- //...
-}
-</pre></blockquote>
-
-<h2><a name="demo">Demonstration Program</a></h2>
-
-<p>The program integer_test.cpp is a
-simplistic demonstration of the results from instantiating various
-examples of the sized type class templates.</p>
-
-<h2><a name="rationale">Rationale</a></h2>
-
-<p>The rationale for the design of the templates in this header includes:</p>
-
-<ul>
- <li>Avoid recursion because of concern about C++'s limited
- guaranteed recursion depth (17).</li>
- <li>Avoid macros on general principles.</li>
- <li>Try to keep the design as simple as possible.</li>
-</ul>
-
-<h2><a name="alternative">Alternative</a></h2>
-
-<p>If the number of bits required is known beforehand, it may be more
-appropriate to use the types supplied in <cite><a
-href="../../boost/cstdint.hpp"><boost/cstdint.hpp></a></cite>.</p>
-
-<h2><a name="credits">Credits</a></h2>
-
-<p>The author of most of the Boost integer type choosing templates is <a
-href="http://www.boost.org/people/beman_dawes.html">Beman Dawes</a>. He gives thanks
-to Valentin Bonnard and
- Kevlin Henney for sharing
-their designs for similar templates. <a
-href="http://www.boost.org/people/daryle_walker.html">Daryle Walker</a> designed the
-value-based sized templates.</p>
-
-<hr>
-
-<p>Revised May 20, 2001</p>
-
-<p>© Copyright Beman Dawes 1999. Use, modification, and distribution are
-subject to the Boost Software License, Version 1.0. (See accompanying file <a
-href="../../LICENSE_1_0.txt">LICENSE_1_0.txt</a> or a copy at <<a
-href="http://www.boost.org/LICENSE_1_0.txt">http://www.boost.org/LICENSE_1_0.txt>>.)</p>
-</body>
-</html>
Deleted: branches/release/libs/integer/integer_traits.html
==============================================================================
--- branches/release/libs/integer/integer_traits.html 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
+++ (empty file)
@@ -1,94 +0,0 @@
-<html>
-
-<head>
-<meta http-equiv="Content-Type" content="text/html; charset=iso-8859-1">
-
-<title>integer_traits: Compile-Time Limits for Integral Types</title>
-</head>
-
-<body bgcolor="#FFFFFF" text="#000000">
-
-<h1><img src="../../boost.png" alt="boost.png (6897 bytes)" align="center" width="277" height="86">Compile-Time Integral
-Type Limits</h1>
-
-<p>
-The C++ Standard Library <limits> header supplies a class template
-numeric_limits<> with specializations for each fundamental
-type.</p>
-<p>
-For integer types, the interesting members of std::numeric_limits<> are:
-<pre> static const bool is_specialized; // will be true for integers
- static T min() throw();
- static T max() throw();
- static const int digits; // for integers, # value bits
- static const int digits10;
- static const bool is_signed;
- static const bool is_integer; // will be true for integers</pre>
-For many uses, these are sufficient. But min() and max() are problematical because they are not constant expressions
-(std::5.19), yet some usages require constant expressions.
-<p>
-The template class <code>integer_traits</code> addresses this
-problem.
-
-
-<h2>Header <code>integer_traits.hpp</code> Synopsis</h2>
-
-<pre>namespace boost {
- template<class T>
- class integer_traits : public std::numeric_limits<T>
- {
- static const bool is_integral = false;
- };
-
- // specializations for all integral types
-}</pre>
-
-
-<h2>Description</h2>
-
-Template class <code>integer_traits</code> is derived from
-<code>std::numeric_limits</code>. In general, it adds the single
-<code>bool</code> member <code>is_integral</code> with the
-compile-time constant value <code>false</code>. However, for all
-integral types <code>T</code> (std::3.9.1/7 [basic.fundamental]),
-there are specializations provided with the following compile-time
-constants defined:
-<p>
-<table border=1>
-<tr><th>member</th><th>type</th><th>value</th></tr>
-<tr><td><code>is_integral</code></td><td>bool</td><td><code>true</code></td></tr>
-<tr><td><code>const_min</code></td><td><code>T</code></td><td>equivalent
-to <code>std::numeric_limits<T>::min()</code></td></tr>
-<tr><td><code>const_max</code></td><td><code>T</code></td><td>equivalent
-to <code>std::numeric_limits<T>::max()</code></td></tr>
-</table>
-
-<p>
-
-<em>Note:</em> A flag <code>is_integral</code> is provided, because a
-user-defined integer class should specialize
-<code>std::numeric_limits<>::is_integer = true</code>,
-nonetheless compile-time constants <code>const_min</code> and
-<code>const_max</code> cannot be provided for that user-defined class.
-
-<h2>
-
-Test Program</h2>
-
-<p>
-
-The program <code>integer_traits_test.cpp</code>
-exercises the <code>integer_traits</code> class.
-
-<h2>Acknowledgements</h2>
-
-Beman Dawes, Ed Brey, Steve Cleary, and Nathan Myers discussed the integer
-traits idea on the boost mailing list in August 1999.
-<hr>
-<p>Revised
-<!--webbot bot="Timestamp" S-Type="EDITED" S-Format="%d %B %Y" startspan -->06 November 2007<!--webbot bot="Timestamp" endspan i-checksum="40336" --></p>
-<p>© Copyright Beman Dawes 2000</p>
-
-<p>Distributed under the Boost Software License, Version 1.0. See
-www.boost.org/LICENSE_1_0.txt</p>
-
Modified: branches/release/libs/integer/test/Jamfile.v2
==============================================================================
--- branches/release/libs/integer/test/Jamfile.v2 (original)
+++ branches/release/libs/integer/test/Jamfile.v2 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -4,17 +4,22 @@
import testing ;
+project : requirements <warnings>all <toolset>gcc:<cxxflags>-Wextra ;
+
test-suite integer
- : [ run cstdint_test.cpp ]
- [ run integer_test.cpp
- /boost/test//boost_unit_test_framework ]
- [ run integer_traits_test.cpp
- /boost/test//boost_test_exec_monitor/<link>static ]
- [ run integer_mask_test.cpp
- /boost/test//boost_unit_test_framework ]
- [ run static_log2_test.cpp
- /boost/test//boost_test_exec_monitor/<link>static ]
- [ run static_min_max_test.cpp
- /boost/test//boost_test_exec_monitor/<link>static ]
-# [ compile issue_2134.cpp ]
+ :
+ [ run cstdint_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
+ [ run cstdint_test2.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long ]
+ [ run integer_traits_test.cpp ]
+ [ run integer_test.cpp : : : <toolset>gcc:<cxxflags>-Wno-long-long <toolset>darwin:<cxxflags>-Wno-long-long <toolset>sun:<cxxflags>"-Qoption ccfe -tmpldepth=128" ]
+ [ run integer_mask_test.cpp ]
+ [ run static_log2_test.cpp ]
+ [ run static_min_max_test.cpp ]
+ [ compile cstdint_include_test.cpp ]
+ [ compile integer_traits_include_test.cpp ]
+ [ compile integer_include_test.cpp ]
+ [ compile integer_mask_include_test.cpp ]
+ [ compile static_log2_include_test.cpp ]
+ [ compile static_min_max_include_test.cpp ]
+ [ compile integer_fwd_include_test.cpp ]
;
Modified: branches/release/libs/integer/test/cstdint_test.cpp
==============================================================================
--- branches/release/libs/integer/test/cstdint_test.cpp (original)
+++ branches/release/libs/integer/test/cstdint_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -12,18 +12,24 @@
// 12 Nov 00 Adapted to merged <boost/cstdint.hpp>
// 23 Sep 00 Added INTXX_C constant macro support + int64_t support (John Maddock).
// 28 Jun 00 Initial version
-#define __STDC_CONSTANT_MACROS
-#include <cassert>
-#include <iostream>
-#include <boost/cstdint.hpp>
-#ifdef NDEBUG
-int main()
-{
- std::cout << "This test makes no sense with NDEBUG defined.\n";
- return 0;
-}
-#else
+//
+// There are two ways to test this: in version 1, we include cstdint.hpp as the first
+// include, which means we get decide whether __STDC_CONSTANT_MACROS is defined.
+// In version two we include stdint.h with __STDC_CONSTANT_MACROS *NOT* defined first,
+// and check that we still end up with compatible definitions for the INT#_C macros.
+//
+// This is version 1.
+//
+
+#if defined(__GNUC__) && (__GNUC__ > 4) || ((__GNUC__ == 4) && (__GNUC_MINOR__ >= 4))
+// We can't suppress this warning on the command line as not all GCC versions support -Wno-type-limits :
+#pragma GCC diagnostic ignored "-Wtype-limits"
+#endif
+
+#include <boost/cstdint.hpp>
+#include <boost/detail/lightweight_test.hpp>
+#include <iostream>
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
//
@@ -62,24 +68,24 @@
void integral_constant_checker::check()
{
- assert( int8 == -127 );
- assert( int_least8 == -127 );
- assert( int_fast8 == -127 );
- assert( uint8 == 255u );
- assert( uint_least8 == 255u );
- assert( uint_fast8 == 255u );
- assert( int16 == -32767 );
- assert( int_least16 == -32767 );
- assert( int_fast16 == -32767 );
- assert( uint16 == 65535u );
- assert( uint_least16 == 65535u );
- assert( uint_fast16 == 65535u );
- assert( int32 == -2147483647 );
- assert( int_least32 == -2147483647 );
- assert( int_fast32 == -2147483647 );
- assert( uint32 == 4294967295u );
- assert( uint_least32 == 4294967295u );
- assert( uint_fast32 == 4294967295u );
+ BOOST_TEST( int8 == -127 );
+ BOOST_TEST( int_least8 == -127 );
+ BOOST_TEST( int_fast8 == -127 );
+ BOOST_TEST( uint8 == 255u );
+ BOOST_TEST( uint_least8 == 255u );
+ BOOST_TEST( uint_fast8 == 255u );
+ BOOST_TEST( int16 == -32767 );
+ BOOST_TEST( int_least16 == -32767 );
+ BOOST_TEST( int_fast16 == -32767 );
+ BOOST_TEST( uint16 == 65535u );
+ BOOST_TEST( uint_least16 == 65535u );
+ BOOST_TEST( uint_fast16 == 65535u );
+ BOOST_TEST( int32 == -2147483647 );
+ BOOST_TEST( int_least32 == -2147483647 );
+ BOOST_TEST( int_fast32 == -2147483647 );
+ BOOST_TEST( uint32 == 4294967295u );
+ BOOST_TEST( uint_least32 == 4294967295u );
+ BOOST_TEST( uint_fast32 == 4294967295u );
}
#endif // BOOST_NO_INCLASS_MEMBER_INITIALIZATION
@@ -108,10 +114,10 @@
// if we have a native stdint.h
// then the INTXX_C macros may define
// a type that's wider than required:
- assert(sizeof(T1) <= sizeof(T2));
+ BOOST_TEST(sizeof(T1) <= sizeof(T2));
#else
- assert(sizeof(T1) == sizeof(T2));
- assert(t1 == t2);
+ BOOST_TEST(sizeof(T1) == sizeof(T2));
+ BOOST_TEST(t1 == t2);
#endif
#if defined(BOOST_HAS_STDINT_H)
// native headers are permitted to promote small
@@ -119,22 +125,22 @@
if(sizeof(T1) >= sizeof(int))
{
if(t1 > 0)
- assert(t2 > 0);
+ BOOST_TEST(t2 > 0);
else
- assert(!(t2 > 0));
+ BOOST_TEST(!(t2 > 0));
}
else if(t1 < 0)
- assert(!(t2 > 0));
+ BOOST_TEST(!(t2 > 0));
#else
if(t1 > 0)
- assert(t2 > 0);
+ BOOST_TEST(t2 > 0);
else
- assert(!(t2 > 0));
+ BOOST_TEST(!(t2 > 0));
#endif
}
-int main()
+int main(int, char*[])
{
#ifndef BOOST_NO_INCLASS_MEMBER_INITIALIZATION
integral_constant_checker::check();
@@ -193,41 +199,40 @@
boost::uintmax_t uintmax = UINTMAX_C(4294967295);
#endif
- assert( int8 == -127 );
- assert( int_least8 == -127 );
- assert( int_fast8 == -127 );
- assert( uint8 == 255u );
- assert( uint_least8 == 255u );
- assert( uint_fast8 == 255u );
- assert( int16 == -32767 );
- assert( int_least16 == -32767 );
- assert( int_fast16 == -32767 );
- assert( uint16 == 65535u );
- assert( uint_least16 == 65535u );
- assert( uint_fast16 == 65535u );
- assert( int32 == -2147483647 );
- assert( int_least32 == -2147483647 );
- assert( int_fast32 == -2147483647 );
- assert( uint32 == 4294967295u );
- assert( uint_least32 == 4294967295u );
- assert( uint_fast32 == 4294967295u );
+ BOOST_TEST( int8 == -127 );
+ BOOST_TEST( int_least8 == -127 );
+ BOOST_TEST( int_fast8 == -127 );
+ BOOST_TEST( uint8 == 255u );
+ BOOST_TEST( uint_least8 == 255u );
+ BOOST_TEST( uint_fast8 == 255u );
+ BOOST_TEST( int16 == -32767 );
+ BOOST_TEST( int_least16 == -32767 );
+ BOOST_TEST( int_fast16 == -32767 );
+ BOOST_TEST( uint16 == 65535u );
+ BOOST_TEST( uint_least16 == 65535u );
+ BOOST_TEST( uint_fast16 == 65535u );
+ BOOST_TEST( int32 == -2147483647 );
+ BOOST_TEST( int_least32 == -2147483647 );
+ BOOST_TEST( int_fast32 == -2147483647 );
+ BOOST_TEST( uint32 == 4294967295u );
+ BOOST_TEST( uint_least32 == 4294967295u );
+ BOOST_TEST( uint_fast32 == 4294967295u );
#ifndef BOOST_NO_INT64_T
- assert( int64 == INT64_C(-9223372036854775807) );
- assert( int_least64 == INT64_C(-9223372036854775807) );
- assert( int_fast64 == INT64_C(-9223372036854775807) );
- assert( uint64 == UINT64_C(18446744073709551615) );
- assert( uint_least64 == UINT64_C(18446744073709551615) );
- assert( uint_fast64 == UINT64_C(18446744073709551615) );
- assert( intmax == INT64_C(-9223372036854775807) );
- assert( uintmax == UINT64_C(18446744073709551615) );
+ BOOST_TEST( int64 == INT64_C(-9223372036854775807) );
+ BOOST_TEST( int_least64 == INT64_C(-9223372036854775807) );
+ BOOST_TEST( int_fast64 == INT64_C(-9223372036854775807) );
+ BOOST_TEST( uint64 == UINT64_C(18446744073709551615) );
+ BOOST_TEST( uint_least64 == UINT64_C(18446744073709551615) );
+ BOOST_TEST( uint_fast64 == UINT64_C(18446744073709551615) );
+ BOOST_TEST( intmax == INT64_C(-9223372036854775807) );
+ BOOST_TEST( uintmax == UINT64_C(18446744073709551615) );
#else
- assert( intmax == -2147483647 );
- assert( uintmax == 4294967295u );
+ BOOST_TEST( intmax == -2147483647 );
+ BOOST_TEST( uintmax == 4294967295u );
#endif
std::cout << "OK\n";
- return 0;
+ return boost::report_errors();
}
-#endif
Modified: branches/release/libs/integer/test/integer_mask_test.cpp
==============================================================================
--- branches/release/libs/integer/test/integer_mask_test.cpp (original)
+++ branches/release/libs/integer/test/integer_mask_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -10,30 +10,43 @@
// Revision History
// 23 Sep 2001 Initial version (Daryle Walker)
-#include <boost/test/minimal.hpp> // for main
+#include <boost/detail/lightweight_test.hpp>
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/integer/integer_mask.hpp> // for boost::high_bit_mask_t, etc.
#include <iostream> // for std::cout (std::endl indirectly)
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127) // conditional expression is constant
+#endif
-#define PRIVATE_HIGH_BIT_SLOW_TEST(v) BOOST_CHECK( ::boost::high_bit_mask_t< \
+#define PRIVATE_HIGH_BIT_SLOW_TEST(v) BOOST_TEST( ::boost::high_bit_mask_t< \
(v) >::high_bit == (1ul << (v)) );
-#define PRIVATE_HIGH_BIT_FAST_TEST(v) BOOST_CHECK( ::boost::high_bit_mask_t< \
+#define PRIVATE_HIGH_BIT_FAST_TEST(v) BOOST_TEST( ::boost::high_bit_mask_t< \
(v) >::high_bit_fast == (1ul << (v)) );
#define PRIVATE_HIGH_BIT_TEST(v) do { PRIVATE_HIGH_BIT_SLOW_TEST(v); \
PRIVATE_HIGH_BIT_FAST_TEST(v); } while (false)
-#define PRIVATE_LOW_BITS_SLOW_TEST(v) BOOST_CHECK( ::boost::low_bits_mask_t< \
- (v) >::sig_bits == ((1ul << (v)) - 1) );
-#define PRIVATE_LOW_BITS_FAST_TEST(v) BOOST_CHECK( ::boost::low_bits_mask_t< \
- (v) >::sig_bits_fast == ((1ul << (v)) - 1) );
+#define PRIVATE_LOW_BITS_SLOW_TEST(v) \
+ do{ \
+ unsigned long mask = 0;\
+ if(v > 0)\
+ { mask = ((1ul << (v-1)) - 1); mask <<= 1; mask |= 1; }\
+ BOOST_TEST( ::boost::low_bits_mask_t< (v) >::sig_bits == mask); \
+ }while(false);
+#define PRIVATE_LOW_BITS_FAST_TEST(v) \
+ do{ \
+ unsigned long mask = 0;\
+ if(v > 0)\
+ { mask = ((1ul << (v-1)) - 1); mask <<= 1; mask |= 1; }\
+ BOOST_TEST( ::boost::low_bits_mask_t< (v) >::sig_bits_fast == mask);\
+ }while(false);
#define PRIVATE_LOW_BITS_TEST(v) do { PRIVATE_LOW_BITS_SLOW_TEST(v); \
PRIVATE_LOW_BITS_FAST_TEST(v); } while (false)
-int test_main( int, char*[] )
+int main( int, char*[] )
{
using std::cout;
using std::endl;
@@ -73,7 +86,7 @@
PRIVATE_HIGH_BIT_TEST( 0 );
cout << "Doing low_bits_mask_t tests." << endl;
- PRIVATE_LOW_BITS_TEST( 32 ); // Undefined behavior? Whoops!
+ PRIVATE_LOW_BITS_TEST( 32 );
PRIVATE_LOW_BITS_TEST( 31 );
PRIVATE_LOW_BITS_TEST( 30 );
PRIVATE_LOW_BITS_TEST( 29 );
@@ -106,5 +119,5 @@
PRIVATE_LOW_BITS_TEST( 2 );
PRIVATE_LOW_BITS_TEST( 1 );
- return boost::exit_success;
+ return boost::report_errors();
}
Modified: branches/release/libs/integer/test/integer_test.cpp
==============================================================================
--- branches/release/libs/integer/test/integer_test.cpp (original)
+++ branches/release/libs/integer/test/integer_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -1,6 +1,9 @@
// boost integer.hpp test program ------------------------------------------//
-// Copyright Beman Dawes 1999. Distributed under the Boost
+// Copyright Beman Dawes 1999.
+// Copyright Daryle Walker 2001.
+// Copyright John Maddock 2009.
+// Distributed under the Boost
// Software License, Version 1.0. (See accompanying file
// LICENSE_1_0.txt or copy at http://www.boost.org/LICENSE_1_0.txt)
@@ -12,280 +15,249 @@
// 10 Mar 01 Boost Test Library now used for tests (Beman Dawes)
// 31 Aug 99 Initial version
-#include <boost/test/minimal.hpp> // for main, BOOST_CHECK
-
-#include <boost/config.hpp> // for BOOST_NO_USING_TEMPLATE
-#include <boost/cstdlib.hpp> // for boost::exit_success
+#include <boost/detail/lightweight_test.hpp> // for main, BOOST_TEST
#include <boost/integer.hpp> // for boost::int_t, boost::uint_t
+#include <boost/type_traits/is_same.hpp>
#include <climits> // for ULONG_MAX, LONG_MAX, LONG_MIN
#include <iostream> // for std::cout (std::endl indirectly)
#include <typeinfo> // for std::type_info
+#ifdef BOOST_MSVC
+#pragma warning(disable:4127) // conditional expression is constant
+#endif
+#if defined( __BORLANDC__ )
+# pragma option -w-8008 -w-8066 // condition is always true
+#endif
-// Control if the names of the types for each version
-// of the integer templates will be printed.
-#ifndef CONTROL_SHOW_TYPES
-#define CONTROL_SHOW_TYPES 0
+//
+// Keep track of error count, so we can print out detailed
+// info only if we need it:
+//
+int last_error_count = 0;
+//
+// Helpers to print out the name of a type,
+// we use these as typeid(X).name() doesn't always
+// return a human readable string:
+//
+template <class T> const char* get_name_of_type(T){ return typeid(T).name(); }
+const char* get_name_of_type(signed char){ return "signed char"; }
+const char* get_name_of_type(unsigned char){ return "unsigned char"; }
+const char* get_name_of_type(short){ return "short"; }
+const char* get_name_of_type(unsigned short){ return "unsigned short"; }
+const char* get_name_of_type(int){ return "int"; }
+const char* get_name_of_type(unsigned int){ return "unsigned int"; }
+const char* get_name_of_type(long){ return "long"; }
+const char* get_name_of_type(unsigned long){ return "unsigned long"; }
+#ifdef BOOST_HAS_LONG_LONG
+const char* get_name_of_type(boost::long_long_type){ return "boost::long_long_type"; }
+const char* get_name_of_type(boost::ulong_long_type){ return "boost::ulong_long_type"; }
#endif
+template <int Bits>
+void do_test_exact(boost::mpl::true_ const&)
+{
+ // Test the ::exact member:
+ typedef typename boost::int_t<Bits>::exact int_exact;
+ typedef typename boost::uint_t<Bits>::exact uint_exact;
+ typedef typename boost::int_t<Bits>::least least_int;
+ typedef typename boost::uint_t<Bits>::least least_uint;
-// If specializations have not already been done, then we can confirm
-// the effects of the "fast" types by making a specialization.
-namespace boost
+ BOOST_TEST((boost::is_same<int_exact, least_int>::value));
+ BOOST_TEST((boost::is_same<uint_exact, least_uint>::value));
+}
+template <int Bits>
+void do_test_exact(boost::mpl::false_ const&)
{
- template < >
- struct int_fast_t< short >
- {
- typedef long fast;
- };
+ // Nothing to do, type does not have an ::extact member.
}
-
-// Show the types of an integer template version
-#if CONTROL_SHOW_TYPES
-#define SHOW_TYPE(Template, Number, Type) ::std::cout << "Type \"" \
- #Template "<" #Number ">::" #Type "\" is \"" << typeid(Template < \
- Number > :: Type).name() << ".\"\n"
-#else
-#define SHOW_TYPE(Template, Number, Type)
-#endif
-
-#define SHOW_TYPES(Template, Type) SHOW_TYPE(Template, 32, Type); \
- SHOW_TYPE(Template, 31, Type); SHOW_TYPE(Template, 30, Type); \
- SHOW_TYPE(Template, 29, Type); SHOW_TYPE(Template, 28, Type); \
- SHOW_TYPE(Template, 27, Type); SHOW_TYPE(Template, 26, Type); \
- SHOW_TYPE(Template, 25, Type); SHOW_TYPE(Template, 24, Type); \
- SHOW_TYPE(Template, 23, Type); SHOW_TYPE(Template, 22, Type); \
- SHOW_TYPE(Template, 21, Type); SHOW_TYPE(Template, 20, Type); \
- SHOW_TYPE(Template, 19, Type); SHOW_TYPE(Template, 18, Type); \
- SHOW_TYPE(Template, 17, Type); SHOW_TYPE(Template, 16, Type); \
- SHOW_TYPE(Template, 15, Type); SHOW_TYPE(Template, 14, Type); \
- SHOW_TYPE(Template, 13, Type); SHOW_TYPE(Template, 12, Type); \
- SHOW_TYPE(Template, 11, Type); SHOW_TYPE(Template, 10, Type); \
- SHOW_TYPE(Template, 9, Type); SHOW_TYPE(Template, 8, Type); \
- SHOW_TYPE(Template, 7, Type); SHOW_TYPE(Template, 6, Type); \
- SHOW_TYPE(Template, 5, Type); SHOW_TYPE(Template, 4, Type); \
- SHOW_TYPE(Template, 3, Type); SHOW_TYPE(Template, 2, Type); \
- SHOW_TYPE(Template, 1, Type); SHOW_TYPE(Template, 0, Type)
-
-#define SHOW_SHIFTED_TYPE(Template, Number, Type) SHOW_TYPE(Template, (1UL << Number), Type)
-
-#define SHOW_SHIFTED_TYPES(Template, Type) SHOW_SHIFTED_TYPE(Template, 30, Type); \
- SHOW_SHIFTED_TYPE(Template, 29, Type); SHOW_SHIFTED_TYPE(Template, 28, Type); \
- SHOW_SHIFTED_TYPE(Template, 27, Type); SHOW_SHIFTED_TYPE(Template, 26, Type); \
- SHOW_SHIFTED_TYPE(Template, 25, Type); SHOW_SHIFTED_TYPE(Template, 24, Type); \
- SHOW_SHIFTED_TYPE(Template, 23, Type); SHOW_SHIFTED_TYPE(Template, 22, Type); \
- SHOW_SHIFTED_TYPE(Template, 21, Type); SHOW_SHIFTED_TYPE(Template, 20, Type); \
- SHOW_SHIFTED_TYPE(Template, 19, Type); SHOW_SHIFTED_TYPE(Template, 18, Type); \
- SHOW_SHIFTED_TYPE(Template, 17, Type); SHOW_SHIFTED_TYPE(Template, 16, Type); \
- SHOW_SHIFTED_TYPE(Template, 15, Type); SHOW_SHIFTED_TYPE(Template, 14, Type); \
- SHOW_SHIFTED_TYPE(Template, 13, Type); SHOW_SHIFTED_TYPE(Template, 12, Type); \
- SHOW_SHIFTED_TYPE(Template, 11, Type); SHOW_SHIFTED_TYPE(Template, 10, Type); \
- SHOW_SHIFTED_TYPE(Template, 9, Type); SHOW_SHIFTED_TYPE(Template, 8, Type); \
- SHOW_SHIFTED_TYPE(Template, 7, Type); SHOW_SHIFTED_TYPE(Template, 6, Type); \
- SHOW_SHIFTED_TYPE(Template, 5, Type); SHOW_SHIFTED_TYPE(Template, 4, Type); \
- SHOW_SHIFTED_TYPE(Template, 3, Type); SHOW_SHIFTED_TYPE(Template, 2, Type); \
- SHOW_SHIFTED_TYPE(Template, 1, Type); SHOW_SHIFTED_TYPE(Template, 0, Type)
-
-#define SHOW_POS_SHIFTED_TYPE(Template, Number, Type) SHOW_TYPE(Template, +(1L << Number), Type)
-
-#define SHOW_POS_SHIFTED_TYPES(Template, Type) SHOW_POS_SHIFTED_TYPE(Template, 30, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 29, Type); SHOW_POS_SHIFTED_TYPE(Template, 28, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 27, Type); SHOW_POS_SHIFTED_TYPE(Template, 26, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 25, Type); SHOW_POS_SHIFTED_TYPE(Template, 24, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 23, Type); SHOW_POS_SHIFTED_TYPE(Template, 22, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 21, Type); SHOW_POS_SHIFTED_TYPE(Template, 20, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 19, Type); SHOW_POS_SHIFTED_TYPE(Template, 18, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 17, Type); SHOW_POS_SHIFTED_TYPE(Template, 16, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 15, Type); SHOW_POS_SHIFTED_TYPE(Template, 14, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 13, Type); SHOW_POS_SHIFTED_TYPE(Template, 12, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 11, Type); SHOW_POS_SHIFTED_TYPE(Template, 10, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 9, Type); SHOW_POS_SHIFTED_TYPE(Template, 8, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 7, Type); SHOW_POS_SHIFTED_TYPE(Template, 6, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 5, Type); SHOW_POS_SHIFTED_TYPE(Template, 4, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 3, Type); SHOW_POS_SHIFTED_TYPE(Template, 2, Type); \
- SHOW_POS_SHIFTED_TYPE(Template, 1, Type); SHOW_POS_SHIFTED_TYPE(Template, 0, Type)
-
-#define SHOW_NEG_SHIFTED_TYPE(Template, Number, Type) SHOW_TYPE(Template, -(1L << Number), Type)
-
-#define SHOW_NEG_SHIFTED_TYPES(Template, Type) SHOW_NEG_SHIFTED_TYPE(Template, 30, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 29, Type); SHOW_NEG_SHIFTED_TYPE(Template, 28, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 27, Type); SHOW_NEG_SHIFTED_TYPE(Template, 26, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 25, Type); SHOW_NEG_SHIFTED_TYPE(Template, 24, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 23, Type); SHOW_NEG_SHIFTED_TYPE(Template, 22, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 21, Type); SHOW_NEG_SHIFTED_TYPE(Template, 20, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 19, Type); SHOW_NEG_SHIFTED_TYPE(Template, 18, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 17, Type); SHOW_NEG_SHIFTED_TYPE(Template, 16, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 15, Type); SHOW_NEG_SHIFTED_TYPE(Template, 14, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 13, Type); SHOW_NEG_SHIFTED_TYPE(Template, 12, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 11, Type); SHOW_NEG_SHIFTED_TYPE(Template, 10, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 9, Type); SHOW_NEG_SHIFTED_TYPE(Template, 8, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 7, Type); SHOW_NEG_SHIFTED_TYPE(Template, 6, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 5, Type); SHOW_NEG_SHIFTED_TYPE(Template, 4, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 3, Type); SHOW_NEG_SHIFTED_TYPE(Template, 2, Type); \
- SHOW_NEG_SHIFTED_TYPE(Template, 1, Type); SHOW_NEG_SHIFTED_TYPE(Template, 0, Type)
-
-
-// Test if a constant can fit within a certain type
-#define PRIVATE_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < Number > :: Type ( Value ) == Value )
-
-#if ULONG_MAX > 0xFFFFFFFFL
-#define PRIVATE_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
- PRIVATE_FIT_TEST(Template, 64, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 63, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 62, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 61, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 60, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 59, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 58, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 57, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 56, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 55, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 54, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 53, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 52, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 51, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 50, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 49, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 48, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 47, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 46, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 45, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 44, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 43, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 42, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 41, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 40, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 39, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 38, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 37, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 36, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 35, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 34, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 33, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 32, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 31, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 30, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 29, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 28, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 27, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 26, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 25, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 24, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 23, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 22, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 21, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 20, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 19, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 18, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 17, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 16, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 15, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 14, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 13, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 12, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 11, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 10, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 9, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 8, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 7, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 6, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 5, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 4, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 3, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 2, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 1, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 0, Type, v); } while ( false )
-#else
-#define PRIVATE_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
- PRIVATE_FIT_TEST(Template, 32, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 31, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 30, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 29, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 28, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 27, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 26, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 25, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 24, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 23, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 22, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 21, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 20, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 19, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 18, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 17, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 16, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 15, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 14, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 13, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 12, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 11, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 10, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 9, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 8, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 7, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 6, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 5, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 4, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 3, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 2, Type, v); v >>= 1; \
- PRIVATE_FIT_TEST(Template, 1, Type, v); v >>= 1; PRIVATE_FIT_TEST(Template, 0, Type, v); } while ( false )
+template <int Bits>
+void do_test_bits()
+{
+ //
+ // Recurse to next smallest number of bits:
+ //
+ do_test_bits<Bits - 1>();
+ //
+ // Test exact types if we have them:
+ //
+ do_test_exact<Bits>(
+ boost::mpl::bool_<
+ (sizeof(unsigned char) * CHAR_BIT == Bits)
+ || (sizeof(unsigned short) * CHAR_BIT == Bits)
+ || (sizeof(unsigned int) * CHAR_BIT == Bits)
+ || (sizeof(unsigned long) * CHAR_BIT == Bits)
+#ifdef BOOST_HAS_LONG_LONG
+ || (sizeof(boost::ulong_long_type) * CHAR_BIT == Bits)
#endif
+ >());
+ //
+ // We need to check all aspects of the members of int_t<Bits> and uint_t<Bits>:
+ //
+ typedef typename boost::int_t<Bits>::least least_int;
+ typedef typename boost::int_t<Bits>::least fast_int;
+ typedef typename boost::uint_t<Bits>::least least_uint;
+ typedef typename boost::uint_t<Bits>::fast fast_uint;
+
+ if(std::numeric_limits<least_int>::is_specialized)
+ {
+ BOOST_TEST(std::numeric_limits<least_int>::digits + 1 >= Bits);
+ }
+ if(std::numeric_limits<least_uint>::is_specialized)
+ {
+ BOOST_TEST(std::numeric_limits<least_uint>::digits >= Bits);
+ }
+ BOOST_TEST(sizeof(least_int) * CHAR_BIT >= Bits);
+ BOOST_TEST(sizeof(least_uint) * CHAR_BIT >= Bits);
+ BOOST_TEST(sizeof(fast_int) >= sizeof(least_int));
+ BOOST_TEST(sizeof(fast_uint) >= sizeof(least_uint));
+ //
+ // There should be no type smaller than least_* that also has enough bits:
+ //
+ if(!boost::is_same<signed char, least_int>::value)
+ {
+ BOOST_TEST(std::numeric_limits<signed char>::digits < Bits);
+ if(!boost::is_same<short, least_int>::value)
+ {
+ BOOST_TEST(std::numeric_limits<short>::digits < Bits);
+ if(!boost::is_same<int, least_int>::value)
+ {
+ BOOST_TEST(std::numeric_limits<int>::digits < Bits);
+ if(!boost::is_same<long, least_int>::value)
+ {
+ BOOST_TEST(std::numeric_limits<long>::digits < Bits);
+ }
+ }
+ }
+ }
+ // And again, but unsigned:
+ if(!boost::is_same<unsigned char, least_uint>::value)
+ {
+ BOOST_TEST(std::numeric_limits<unsigned char>::digits < Bits);
+ if(!boost::is_same<unsigned short, least_uint>::value)
+ {
+ BOOST_TEST(std::numeric_limits<unsigned short>::digits < Bits);
+ if(!boost::is_same<unsigned int, least_uint>::value)
+ {
+ BOOST_TEST(std::numeric_limits<unsigned int>::digits < Bits);
+ if(!boost::is_same<unsigned long, least_uint>::value)
+ {
+ BOOST_TEST(std::numeric_limits<unsigned long>::digits < Bits);
+ }
+ }
+ }
+ }
+
+ if(boost::detail::test_errors() != last_error_count)
+ {
+ last_error_count = boost::detail::test_errors();
+ std::cout << "Errors occured while testing with bit count = " << Bits << std::endl;
+ std::cout << "Type int_t<" << Bits << ">::least was " << get_name_of_type(least_int(0)) << std::endl;
+ std::cout << "Type int_t<" << Bits << ">::fast was " << get_name_of_type(fast_int(0)) << std::endl;
+ std::cout << "Type uint_t<" << Bits << ">::least was " << get_name_of_type(least_uint(0)) << std::endl;
+ std::cout << "Type uint_t<" << Bits << ">::fast was " << get_name_of_type(fast_uint(0)) << std::endl;
+ }
+}
+template <>
+void do_test_bits<-1>()
+{
+ // Nothing to do here!!
+}
-#define PRIVATE_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (ULONG_MAX >> Number) > :: Type ( Value ) == Value )
-
-#define PRIVATE_SHIFTED_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 2, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 3, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 4, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 5, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 6, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 7, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 8, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 9, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 10, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 11, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 12, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 13, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 14, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 15, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 16, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 17, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 18, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 19, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 20, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 21, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 22, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 23, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 24, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 25, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 26, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 27, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 28, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 29, Type, v); v >>= 1; \
- PRIVATE_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
-
-#define PRIVATE_POS_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (LONG_MAX >> Number) > :: Type ( Value ) == Value )
-
-#define PRIVATE_POS_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 2, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 3, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 4, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 5, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 6, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 7, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 8, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 9, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 10, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 11, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 12, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 13, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 14, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 15, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 16, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 17, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 18, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 19, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 20, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 21, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 22, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 23, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 24, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 25, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 26, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 27, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 28, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 29, Type, v); v >>= 1; \
- PRIVATE_POS_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_POS_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
-
-#define PRIVATE_NEG_SHIFTED_FIT_TEST(Template, Number, Type, Value) BOOST_CHECK( Template < (LONG_MIN >> Number) > :: Type ( Value ) == Value )
-
-#define PRIVATE_NEG_FIT_TESTS(Template, Type, ValType, InitVal) do { ValType v = InitVal ; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 0, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 1, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 2, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 3, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 4, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 5, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 6, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 7, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 8, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 9, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 10, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 11, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 12, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 13, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 14, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 15, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 16, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 17, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 18, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 19, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 20, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 21, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 22, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 23, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 24, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 25, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 26, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 27, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 28, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 29, Type, v); v >>= 1; \
- PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 30, Type, v); v >>= 1; PRIVATE_NEG_SHIFTED_FIT_TEST(Template, 31, Type, v); } while ( false )
-
+template <class Traits, class Expected>
+void test_min_max_type(Expected val)
+{
+ typedef typename Traits::least least_type;
+ typedef typename Traits::fast fast_type;
+ BOOST_TEST((boost::is_same<least_type, Expected>::value));
+ BOOST_TEST(sizeof(fast_type) >= sizeof(least_type));
+ BOOST_TEST((std::numeric_limits<least_type>::min)() <= val);
+ BOOST_TEST((std::numeric_limits<least_type>::max)() >= val);
+
+ if(boost::detail::test_errors() != last_error_count)
+ {
+ last_error_count = boost::detail::test_errors();
+ std::cout << "Traits type is: " << typeid(Traits).name() << std::endl;
+ std::cout << "Least type is: " << get_name_of_type(least_type(0)) << std::endl;
+ std::cout << "Fast type is: " << get_name_of_type(fast_type(0)) << std::endl;
+ std::cout << "Expected type is: " << get_name_of_type(Expected(0)) << std::endl;
+ std::cout << "Required value is: " << val << std::endl;
+ }
+}
// Test program
-int
-test_main
-(
- int,
- char*[]
-)
+int main(int, char*[])
{
-#ifndef BOOST_NO_USING_TEMPLATE
- using boost::int_t;
- using boost::uint_t;
- using boost::int_max_value_t;
- using boost::int_min_value_t;
- using boost::uint_value_t;
-#else
- using namespace boost;
+ // Test int_t and unint_t first:
+ if(std::numeric_limits<boost::intmax_t>::is_specialized)
+ do_test_bits<std::numeric_limits<boost::uintmax_t>::digits>();
+ else
+ do_test_bits<std::numeric_limits<long>::digits>();
+
+ //
+ // Test min and max value types:
+ //
+ test_min_max_type<boost::int_max_value_t<SCHAR_MAX>, signed char>(SCHAR_MAX);
+ test_min_max_type<boost::int_min_value_t<SCHAR_MIN>, signed char>(SCHAR_MIN);
+ test_min_max_type<boost::uint_value_t<UCHAR_MAX>, unsigned char>(UCHAR_MAX);
+#if(USHRT_MAX != UCHAR_MAX)
+ test_min_max_type<boost::int_max_value_t<SCHAR_MAX+1>, short>(SCHAR_MAX+1);
+ test_min_max_type<boost::int_min_value_t<SCHAR_MIN-1>, short>(SCHAR_MIN-1);
+ test_min_max_type<boost::uint_value_t<UCHAR_MAX+1>, unsigned short>(UCHAR_MAX+1);
+ test_min_max_type<boost::int_max_value_t<SHRT_MAX>, short>(SHRT_MAX);
+ test_min_max_type<boost::int_min_value_t<SHRT_MIN>, short>(SHRT_MIN);
+ test_min_max_type<boost::uint_value_t<USHRT_MAX>, unsigned short>(USHRT_MAX);
#endif
-
- SHOW_TYPES( int_t, least );
- SHOW_TYPES( int_t, fast );
- SHOW_TYPES( uint_t, least );
- SHOW_TYPES( uint_t, fast );
- SHOW_POS_SHIFTED_TYPES( int_max_value_t, least );
- SHOW_POS_SHIFTED_TYPES( int_max_value_t, fast );
- SHOW_NEG_SHIFTED_TYPES( int_min_value_t, least );
- SHOW_NEG_SHIFTED_TYPES( int_min_value_t, fast );
- SHOW_SHIFTED_TYPES( uint_value_t, least );
- SHOW_SHIFTED_TYPES( uint_value_t, fast );
-
- PRIVATE_FIT_TESTS( int_t, least, long, LONG_MAX );
- PRIVATE_FIT_TESTS( int_t, fast, long, LONG_MAX );
- PRIVATE_FIT_TESTS( uint_t, least, unsigned long, ULONG_MAX );
- PRIVATE_FIT_TESTS( uint_t, fast, unsigned long, ULONG_MAX );
- PRIVATE_POS_FIT_TESTS( int_max_value_t, least, long, LONG_MAX );
- PRIVATE_POS_FIT_TESTS( int_max_value_t, fast, long, LONG_MAX );
- PRIVATE_NEG_FIT_TESTS( int_min_value_t, least, long, LONG_MIN );
- PRIVATE_NEG_FIT_TESTS( int_min_value_t, fast, long, LONG_MIN );
- PRIVATE_SHIFTED_FIT_TESTS( uint_value_t, least, unsigned long, ULONG_MAX );
- PRIVATE_SHIFTED_FIT_TESTS( uint_value_t, fast, unsigned long, ULONG_MAX );
-
- return boost::exit_success;
+#if(UINT_MAX != USHRT_MAX)
+ test_min_max_type<boost::int_max_value_t<SHRT_MAX+1>, int>(SHRT_MAX+1);
+ test_min_max_type<boost::int_min_value_t<SHRT_MIN-1>, int>(SHRT_MIN-1);
+ test_min_max_type<boost::uint_value_t<USHRT_MAX+1>, unsigned int>(USHRT_MAX+1);
+ test_min_max_type<boost::int_max_value_t<INT_MAX>, int>(INT_MAX);
+ test_min_max_type<boost::int_min_value_t<INT_MIN>, int>(INT_MIN);
+ test_min_max_type<boost::uint_value_t<UINT_MAX>, unsigned int>(UINT_MAX);
+#endif
+#if(ULONG_MAX != UINT_MAX)
+ test_min_max_type<boost::int_max_value_t<INT_MAX+1L>, long>(INT_MAX+1L);
+ test_min_max_type<boost::int_min_value_t<INT_MIN-1L>, long>(INT_MIN-1L);
+ test_min_max_type<boost::uint_value_t<UINT_MAX+1uL>, unsigned long>(UINT_MAX+1uL);
+ test_min_max_type<boost::int_max_value_t<LONG_MAX>, long>(LONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN>, long>(LONG_MIN);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX>, unsigned long>(ULONG_MAX);
+#endif
+#ifndef BOOST_NO_INTEGRAL_INT64_T
+#if defined(BOOST_HAS_LONG_LONG) && (defined(ULLONG_MAX) && (ULLONG_MAX != ULONG_MAX))
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LLONG_MAX>, boost::long_long_type>(LLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LLONG_MIN>, boost::long_long_type>(LLONG_MIN);
+ test_min_max_type<boost::uint_value_t<ULLONG_MAX>, boost::ulong_long_type>(ULLONG_MAX);
+#endif
+#if defined(BOOST_HAS_LONG_LONG) && (defined(ULONG_LONG_MAX) && (ULONG_LONG_MAX != ULONG_MAX))
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LONG_LONG_MAX>, boost::long_long_type>(LONG_LONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LONG_LONG_MIN>, boost::long_long_type>(LONG_LONG_MIN);
+ test_min_max_type<boost::uint_value_t<ULONG_LONG_MAX>, boost::ulong_long_type>(ULONG_LONG_MAX);
+#endif
+#if defined(BOOST_HAS_LONG_LONG) && (defined(ULONGLONG_MAX) && (ULONGLONG_MAX != ULONG_MAX))
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<LONGLONG_MAX>, boost::long_long_type>(LONGLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<LONGLONG_MIN>, boost::long_long_type>(LONGLONG_MAX);
+ test_min_max_type<boost::uint_value_t<ULONGLONG_MAX>, boost::ulong_long_type>(ULONGLONG_MAX);
+#endif
+#if defined(BOOST_HAS_LONG_LONG) && (defined(_ULLONG_MAX) && defined(_LLONG_MIN) && (_ULLONG_MAX != ULONG_MAX))
+ test_min_max_type<boost::int_max_value_t<LONG_MAX+1LL>, boost::long_long_type>(LONG_MAX+1LL);
+ test_min_max_type<boost::int_min_value_t<LONG_MIN-1LL>, boost::long_long_type>(LONG_MIN-1LL);
+ test_min_max_type<boost::uint_value_t<ULONG_MAX+1uLL>, boost::ulong_long_type>(ULONG_MAX+1uLL);
+ test_min_max_type<boost::int_max_value_t<_LLONG_MAX>, boost::long_long_type>(_LLONG_MAX);
+ test_min_max_type<boost::int_min_value_t<_LLONG_MIN>, boost::long_long_type>(_LLONG_MIN);
+ test_min_max_type<boost::uint_value_t<_ULLONG_MAX>, boost::ulong_long_type>(_ULLONG_MAX);
+#endif // BOOST_HAS_LONG_LONG
+#endif // BOOST_NO_INTEGRAL_INT64_T
+ return boost::report_errors();
}
Modified: branches/release/libs/integer/test/integer_traits_test.cpp
==============================================================================
--- branches/release/libs/integer/test/integer_traits_test.cpp (original)
+++ branches/release/libs/integer/test/integer_traits_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -17,8 +17,7 @@
// use int64_t instead of long long for better portability
#include <boost/cstdint.hpp>
-#define BOOST_INCLUDE_MAIN
-#include <boost/test/test_tools.hpp>
+#include <boost/detail/lightweight_test.hpp>
/*
* General portability note:
@@ -53,22 +52,22 @@
<< "; min is " << make_char_numeric_for_streaming((traits::min)())
<< ", max is " << make_char_numeric_for_streaming((traits::max)())
<< std::endl;
- BOOST_CHECK(traits::is_specialized);
+ BOOST_TEST(traits::is_specialized);
#if defined(BOOST_MSVC) && (BOOST_MSVC <= 1200)
// MSVC++ 6.0 issues a LNK1179 error (duplicate comdat) when the compiler
// generates different symbol names with a very long common prefix:
// the dummy "&& true" disambiguates between the symbols generated by this
- // BOOST_CHECK instantiation and the preceding one.
- BOOST_CHECK(traits::is_integer && true);
+ // BOOST_TEST instantiation and the preceding one.
+ BOOST_TEST(traits::is_integer && true);
#else
- BOOST_CHECK(traits::is_integer);
+ BOOST_TEST(traits::is_integer);
#endif
- BOOST_CHECK(traits::is_integral == true);
- BOOST_CHECK(traits::const_min == (traits::min)());
- BOOST_CHECK(traits::const_max == (traits::max)());
+ BOOST_TEST(traits::is_integral == true);
+ BOOST_TEST(traits::const_min == (traits::min)());
+ BOOST_TEST(traits::const_max == (traits::max)());
}
-int test_main(int, char*[])
+int main(int, char*[])
{
runtest("bool", bool());
runtest("char", char());
@@ -86,7 +85,7 @@
runtest("long", long());
typedef unsigned long unsigned_long;
runtest("unsigned long", unsigned_long());
-#if !defined(BOOST_NO_INT64_T) && (!defined(BOOST_MSVC) || BOOST_MSVC > 1300) && !defined(__BORLANDC__) && !defined(__BEOS__)
+#ifndef BOOST_NO_INTEGRAL_INT64_T
//
// MS/Borland compilers can't support 64-bit member constants
// BeOS doesn't have specialisations for long long in SGI's <limits> header.
@@ -97,6 +96,6 @@
#endif
// Some compilers don't pay attention to std:3.6.1/5 and issue a
// warning here if "return 0;" is omitted.
- return 0;
+ return boost::report_errors();
}
Modified: branches/release/libs/integer/test/static_log2_test.cpp
==============================================================================
--- branches/release/libs/integer/test/static_log2_test.cpp (original)
+++ branches/release/libs/integer/test/static_log2_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -10,8 +10,7 @@
// Revision History
// 01 Oct 2001 Initial version (Daryle Walker)
-#define BOOST_INCLUDE_MAIN
-#include <boost/test/test_tools.hpp> // for main
+#include <boost/detail/lightweight_test.hpp> // for main
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/integer/static_log2.hpp> // for boost::static_log2
@@ -20,7 +19,7 @@
// Macros to compact code
-#define PRIVATE_LB_TEST( v, e ) BOOST_CHECK( ::boost::static_log2<v>::value == e )
+#define PRIVATE_LB_TEST( v, e ) BOOST_TEST( ::boost::static_log2<v>::value == e )
#define PRIVATE_PRINT_LB( v ) ::std::cout << "boost::static_log2<" << (v) \
<< "> = " << ::boost::static_log2< (v) >::value << '.' << ::std::endl
@@ -35,7 +34,7 @@
// Main testing function
int
-test_main
+main
(
int , // "argc" is unused
char * [] // "argv" is unused
@@ -146,5 +145,5 @@
PRIVATE_LB_TEST( 65536, 16 );
PRIVATE_LB_TEST( 65537, 16 );
- return boost::exit_success;
+ return boost::report_errors();
}
Modified: branches/release/libs/integer/test/static_min_max_test.cpp
==============================================================================
--- branches/release/libs/integer/test/static_min_max_test.cpp (original)
+++ branches/release/libs/integer/test/static_min_max_test.cpp 2009-12-14 13:14:48 EST (Mon, 14 Dec 2009)
@@ -10,8 +10,7 @@
// Revision History
// 23 Sep 2001 Initial version (Daryle Walker)
-#define BOOST_INCLUDE_MAIN
-#include <boost/test/test_tools.hpp> // for main, BOOST_CHECK
+#include <boost/detail/lightweight_test.hpp> // for main, BOOST_TEST
#include <boost/cstdlib.hpp> // for boost::exit_success
#include <boost/integer/static_min_max.hpp> // for boost::static_signed_min, etc.
@@ -21,7 +20,7 @@
// Main testing function
int
-test_main
+main
(
int , // "argc" is unused
char * [] // "argv" is unused
@@ -37,57 +36,57 @@
// Two positives
cout << "Doing tests with two positive values." << endl;
- BOOST_CHECK( (static_signed_min< 9, 14>::value) == 9 );
- BOOST_CHECK( (static_signed_max< 9, 14>::value) == 14 );
- BOOST_CHECK( (static_signed_min<14, 9>::value) == 9 );
- BOOST_CHECK( (static_signed_max<14, 9>::value) == 14 );
-
- BOOST_CHECK( (static_unsigned_min< 9, 14>::value) == 9 );
- BOOST_CHECK( (static_unsigned_max< 9, 14>::value) == 14 );
- BOOST_CHECK( (static_unsigned_min<14, 9>::value) == 9 );
- BOOST_CHECK( (static_unsigned_max<14, 9>::value) == 14 );
+ BOOST_TEST( (static_signed_min< 9, 14>::value) == 9 );
+ BOOST_TEST( (static_signed_max< 9, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_min<14, 9>::value) == 9 );
+ BOOST_TEST( (static_signed_max<14, 9>::value) == 14 );
+
+ BOOST_TEST( (static_unsigned_min< 9, 14>::value) == 9 );
+ BOOST_TEST( (static_unsigned_max< 9, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 9>::value) == 9 );
+ BOOST_TEST( (static_unsigned_max<14, 9>::value) == 14 );
// Two negatives
cout << "Doing tests with two negative values." << endl;
- BOOST_CHECK( (static_signed_min< -8, -101>::value) == -101 );
- BOOST_CHECK( (static_signed_max< -8, -101>::value) == -8 );
- BOOST_CHECK( (static_signed_min<-101, -8>::value) == -101 );
- BOOST_CHECK( (static_signed_max<-101, -8>::value) == -8 );
+ BOOST_TEST( (static_signed_min< -8, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< -8, -101>::value) == -8 );
+ BOOST_TEST( (static_signed_min<-101, -8>::value) == -101 );
+ BOOST_TEST( (static_signed_max<-101, -8>::value) == -8 );
// With zero
cout << "Doing tests with zero and a positive or negative value." << endl;
- BOOST_CHECK( (static_signed_min< 0, 14>::value) == 0 );
- BOOST_CHECK( (static_signed_max< 0, 14>::value) == 14 );
- BOOST_CHECK( (static_signed_min<14, 0>::value) == 0 );
- BOOST_CHECK( (static_signed_max<14, 0>::value) == 14 );
-
- BOOST_CHECK( (static_unsigned_min< 0, 14>::value) == 0 );
- BOOST_CHECK( (static_unsigned_max< 0, 14>::value) == 14 );
- BOOST_CHECK( (static_unsigned_min<14, 0>::value) == 0 );
- BOOST_CHECK( (static_unsigned_max<14, 0>::value) == 14 );
-
- BOOST_CHECK( (static_signed_min< 0, -101>::value) == -101 );
- BOOST_CHECK( (static_signed_max< 0, -101>::value) == 0 );
- BOOST_CHECK( (static_signed_min<-101, 0>::value) == -101 );
- BOOST_CHECK( (static_signed_max<-101, 0>::value) == 0 );
+ BOOST_TEST( (static_signed_min< 0, 14>::value) == 0 );
+ BOOST_TEST( (static_signed_max< 0, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_min<14, 0>::value) == 0 );
+ BOOST_TEST( (static_signed_max<14, 0>::value) == 14 );
+
+ BOOST_TEST( (static_unsigned_min< 0, 14>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max< 0, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max<14, 0>::value) == 14 );
+
+ BOOST_TEST( (static_signed_min< 0, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< 0, -101>::value) == 0 );
+ BOOST_TEST( (static_signed_min<-101, 0>::value) == -101 );
+ BOOST_TEST( (static_signed_max<-101, 0>::value) == 0 );
// With identical
cout << "Doing tests with two identical values." << endl;
- BOOST_CHECK( (static_signed_min<0, 0>::value) == 0 );
- BOOST_CHECK( (static_signed_max<0, 0>::value) == 0 );
- BOOST_CHECK( (static_unsigned_min<0, 0>::value) == 0 );
- BOOST_CHECK( (static_unsigned_max<0, 0>::value) == 0 );
-
- BOOST_CHECK( (static_signed_min<14, 14>::value) == 14 );
- BOOST_CHECK( (static_signed_max<14, 14>::value) == 14 );
- BOOST_CHECK( (static_unsigned_min<14, 14>::value) == 14 );
- BOOST_CHECK( (static_unsigned_max<14, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_min<0, 0>::value) == 0 );
+ BOOST_TEST( (static_signed_max<0, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_min<0, 0>::value) == 0 );
+ BOOST_TEST( (static_unsigned_max<0, 0>::value) == 0 );
+
+ BOOST_TEST( (static_signed_min<14, 14>::value) == 14 );
+ BOOST_TEST( (static_signed_max<14, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_min<14, 14>::value) == 14 );
+ BOOST_TEST( (static_unsigned_max<14, 14>::value) == 14 );
- BOOST_CHECK( (static_signed_min< -101, -101>::value) == -101 );
- BOOST_CHECK( (static_signed_max< -101, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_min< -101, -101>::value) == -101 );
+ BOOST_TEST( (static_signed_max< -101, -101>::value) == -101 );
- return boost::exit_success;
+ return boost::report_errors();
}
Boost-Commit list run by bdawes at acm.org, david.abrahams at rcn.com, gregod at cs.rpi.edu, cpdaniel at pacbell.net, john at johnmaddock.co.uk