mirror of
https://github.com/boostorg/integer.git
synced 2025-11-03 17:51:38 +01:00
Update Boost.Integer meta-programming classes to work with intmax_t where possible - ie to be 64-bit clean.
Added quickbook based docs - updated as necessary. Removed old html docs. [SVN r57926]
This commit is contained in:
@@ -17,7 +17,7 @@
|
||||
|
||||
#include <boost/integer_fwd.hpp> // self include
|
||||
|
||||
#include <boost/integer_traits.hpp> // for ::boost::integer_traits
|
||||
#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
|
||||
|
||||
|
||||
@@ -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 @@ namespace boost {
|
||||
// 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 @@ namespace boost {
|
||||
// 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 {
|
||||
|
||||
|
||||
@@ -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 );
|
||||
};
|
||||
|
||||
|
||||
@@ -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> ------------------------------------------------//
|
||||
|
||||
@@ -136,28 +148,26 @@ template < >
|
||||
|
||||
// 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
|
||||
|
||||
|
||||
|
||||
Reference in New Issue
Block a user