mirror of
https://github.com/boostorg/integer.git
synced 2025-11-05 18:51:38 +01:00
First commit of extensively revised documentation including examples for all items and using Quickbook code snippets in the text. TODO Compile failure in common_factor_ct example. Derived html files NOT saved.
This commit is contained in:
@@ -6,6 +6,9 @@
|
||||
|
||||
// See http://www.boost.org/libs/integer for documentation.
|
||||
|
||||
//! \file
|
||||
//! \brief Compile-time evaluation of specified (least and fast) integer types.
|
||||
|
||||
// Revision History
|
||||
// 22 Sep 01 Added value-based integer templates. (Daryle Walker)
|
||||
// 01 Apr 01 Modified to use new <boost/limits.hpp> header. (John Maddock)
|
||||
@@ -42,15 +45,16 @@ namespace boost
|
||||
// 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;
|
||||
struct int_fast_t
|
||||
{
|
||||
typedef LeastInt fast;
|
||||
typedef fast type;
|
||||
}; // imps may specialize
|
||||
|
||||
//! \cond DETAIL
|
||||
namespace detail{
|
||||
|
||||
// convert category to type
|
||||
// convert category to type
|
||||
template< int Category > struct int_least_helper {}; // default is empty
|
||||
template< int Category > struct uint_least_helper {}; // default is empty
|
||||
|
||||
@@ -104,8 +108,8 @@ namespace boost
|
||||
template <> struct exact_unsigned_base_helper<sizeof(boost::ulong_long_type)* CHAR_BIT> { typedef boost::ulong_long_type exact; };
|
||||
#endif
|
||||
|
||||
|
||||
} // namespace detail
|
||||
//! \endcond // DETAIL
|
||||
|
||||
// integer templates specifying number of bits ---------------------------//
|
||||
|
||||
@@ -138,7 +142,7 @@ namespace boost
|
||||
"No suitable unsigned integer type with the requested number of bits is available.");
|
||||
#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 =
|
||||
BOOST_STATIC_CONSTANT(int, s =
|
||||
6 +
|
||||
(Bits <= ::std::numeric_limits<unsigned long>::digits) +
|
||||
(Bits <= ::std::numeric_limits<unsigned int>::digits) +
|
||||
@@ -147,7 +151,7 @@ namespace boost
|
||||
typedef typename detail::int_least_helper< ::boost::uint_t<Bits>::s>::least least;
|
||||
#else
|
||||
typedef typename boost::detail::uint_least_helper
|
||||
<
|
||||
<
|
||||
#ifdef BOOST_HAS_LONG_LONG
|
||||
(Bits <= (int)(sizeof(boost::long_long_type) * CHAR_BIT)) +
|
||||
#else
|
||||
@@ -171,7 +175,7 @@ namespace boost
|
||||
#else
|
||||
template< long MaxValue > // maximum value to require support
|
||||
#endif
|
||||
struct int_max_value_t
|
||||
struct int_max_value_t
|
||||
{
|
||||
typedef typename boost::detail::int_least_helper
|
||||
<
|
||||
@@ -193,7 +197,7 @@ namespace boost
|
||||
#else
|
||||
template< long MinValue > // minimum value to require support
|
||||
#endif
|
||||
struct int_min_value_t
|
||||
struct int_min_value_t
|
||||
{
|
||||
typedef typename boost::detail::int_least_helper
|
||||
<
|
||||
@@ -216,12 +220,12 @@ namespace boost
|
||||
#else
|
||||
template< unsigned long MaxValue > // minimum value to require support
|
||||
#endif
|
||||
struct uint_value_t
|
||||
struct uint_value_t
|
||||
{
|
||||
#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 =
|
||||
BOOST_STATIC_CONSTANT(unsigned, which =
|
||||
1 +
|
||||
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
|
||||
(MaxValue <= ::boost::integer_traits<unsigned int>::const_max) +
|
||||
@@ -229,7 +233,7 @@ namespace boost
|
||||
(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 =
|
||||
BOOST_STATIC_CONSTANT(unsigned, which =
|
||||
1 +
|
||||
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
|
||||
(MaxValue <= ::boost::integer_traits<unsigned long>::const_max) +
|
||||
@@ -240,7 +244,7 @@ namespace boost
|
||||
#endif // BOOST_NO_INTEGRAL_INT64_T
|
||||
#else
|
||||
typedef typename boost::detail::uint_least_helper
|
||||
<
|
||||
<
|
||||
#if !defined(BOOST_NO_INTEGRAL_INT64_T) && defined(BOOST_HAS_LONG_LONG)
|
||||
(MaxValue <= ::boost::integer_traits<boost::ulong_long_type>::const_max) +
|
||||
#else
|
||||
@@ -255,7 +259,6 @@ namespace boost
|
||||
typedef typename int_fast_t<least>::type fast;
|
||||
};
|
||||
|
||||
|
||||
} // namespace boost
|
||||
|
||||
#endif // BOOST_INTEGER_HPP
|
||||
|
||||
Reference in New Issue
Block a user