Replace math with integer, untabify.

This commit is contained in:
Peter Dimov
2015-01-13 20:53:02 +02:00
parent 1a72919419
commit 8dae82faeb
5 changed files with 90 additions and 62 deletions

View File

@ -7,10 +7,10 @@
// See http://www.boost.org for updates, documentation, and revision history. // See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_MATH_COMMON_FACTOR_HPP #ifndef BOOST_INTEGER_COMMON_FACTOR_HPP
#define BOOST_MATH_COMMON_FACTOR_HPP #define BOOST_INTEGER_COMMON_FACTOR_HPP
#include <boost/math/common_factor_ct.hpp> #include <boost/integer/common_factor_ct.hpp>
#include <boost/math/common_factor_rt.hpp> #include <boost/integer/common_factor_rt.hpp>
#endif // BOOST_MATH_COMMON_FACTOR_HPP #endif // BOOST_INTEGER_COMMON_FACTOR_HPP

View File

@ -7,16 +7,15 @@
// See http://www.boost.org for updates, documentation, and revision history. // See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_MATH_COMMON_FACTOR_CT_HPP #ifndef BOOST_INTEGER_COMMON_FACTOR_CT_HPP
#define BOOST_MATH_COMMON_FACTOR_CT_HPP #define BOOST_INTEGER_COMMON_FACTOR_CT_HPP
#include <boost/math_fwd.hpp> // self include #include <boost/integer_fwd.hpp> // self include
#include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc. #include <boost/config.hpp> // for BOOST_STATIC_CONSTANT, etc.
#include <boost/mpl/integral_c.hpp>
namespace boost namespace boost
{ {
namespace math namespace integer
{ {
// Implementation details --------------------------------------------------// // Implementation details --------------------------------------------------//
@ -76,22 +75,28 @@ namespace detail
// Compile-time greatest common divisor evaluator class declaration --------// // Compile-time greatest common divisor evaluator class declaration --------//
template < static_gcd_type Value1, static_gcd_type Value2 > template < static_gcd_type Value1, static_gcd_type Value2 > struct static_gcd
struct static_gcd : public mpl::integral_c<static_gcd_type, (detail::static_gcd_helper_t<Value1, Value2>::value) >
{ {
}; // boost::math::static_gcd BOOST_STATIC_CONSTANT( static_gcd_type, value = (detail::static_gcd_helper_t<Value1, Value2>::value) );
}; // boost::integer::static_gcd
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
template< static_gcd_type Value1, static_gcd_type Value2 > static_gcd_type const static_gcd< Value1, Value2 >::value;
#endif
// Compile-time least common multiple evaluator class declaration ----------// // Compile-time least common multiple evaluator class declaration ----------//
template < static_gcd_type Value1, static_gcd_type Value2 > template < static_gcd_type Value1, static_gcd_type Value2 > struct static_lcm
struct static_lcm : public mpl::integral_c<static_gcd_type, (detail::static_lcm_helper_t<Value1, Value2>::value) >
{ {
}; // boost::math::static_lcm BOOST_STATIC_CONSTANT( static_gcd_type, value = (detail::static_lcm_helper_t<Value1, Value2>::value) );
}; // boost::integer::static_lcm
#if !defined(BOOST_NO_INCLASS_MEMBER_INITIALIZATION)
template< static_gcd_type Value1, static_gcd_type Value2 > static_gcd_type const static_lcm< Value1, Value2 >::value;
#endif
} // namespace math } // namespace integer
} // namespace boost } // namespace boost
#endif // BOOST_MATH_COMMON_FACTOR_CT_HPP #endif // BOOST_INTEGER_COMMON_FACTOR_CT_HPP

View File

@ -12,10 +12,10 @@
// See http://www.boost.org for updates, documentation, and revision history. // See http://www.boost.org for updates, documentation, and revision history.
#ifndef BOOST_MATH_COMMON_FACTOR_RT_HPP #ifndef BOOST_INTEGER_COMMON_FACTOR_RT_HPP
#define BOOST_MATH_COMMON_FACTOR_RT_HPP #define BOOST_INTEGER_COMMON_FACTOR_RT_HPP
#include <boost/math_fwd.hpp> // self include #include <boost/integer_fwd.hpp> // self include
#include <boost/config.hpp> // for BOOST_NESTED_TEMPLATE, etc. #include <boost/config.hpp> // for BOOST_NESTED_TEMPLATE, etc.
#include <boost/limits.hpp> // for std::numeric_limits #include <boost/limits.hpp> // for std::numeric_limits
@ -29,7 +29,7 @@
namespace boost namespace boost
{ {
namespace math namespace integer
{ {
@ -55,7 +55,7 @@ public:
result_type operator ()( first_argument_type const &a, result_type operator ()( first_argument_type const &a,
second_argument_type const &b ) const; second_argument_type const &b ) const;
}; // boost::math::gcd_evaluator }; // boost::integer::gcd_evaluator
// Least common multiple evaluator class declaration -----------------------// // Least common multiple evaluator class declaration -----------------------//
@ -71,7 +71,7 @@ public:
result_type operator ()( first_argument_type const &a, result_type operator ()( first_argument_type const &a,
second_argument_type const &b ) const; second_argument_type const &b ) const;
}; // boost::math::lcm_evaluator }; // boost::integer::lcm_evaluator
// Implementation details --------------------------------------------------// // Implementation details --------------------------------------------------//
@ -450,11 +450,11 @@ lcm
} }
} // namespace math } // namespace integer
} // namespace boost } // namespace boost
#ifdef BOOST_MSVC #ifdef BOOST_MSVC
#pragma warning(pop) #pragma warning(pop)
#endif #endif
#endif // BOOST_MATH_COMMON_FACTOR_RT_HPP #endif // BOOST_INTEGER_COMMON_FACTOR_RT_HPP

View File

@ -158,6 +158,29 @@ template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Valu
template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2> template <static_min_max_unsigned_type Value1, static_min_max_unsigned_type Value2>
struct static_unsigned_max; struct static_unsigned_max;
// From <boost/integer/common_factor_ct.hpp>
#ifdef BOOST_NO_INTEGRAL_INT64_T
typedef unsigned long static_gcd_type;
#else
typedef boost::uintmax_t static_gcd_type;
#endif
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_gcd;
template < static_gcd_type Value1, static_gcd_type Value2 >
struct static_lcm;
// From <boost/integer/common_factor_rt.hpp>
template < typename IntegerType >
class gcd_evaluator;
template < typename IntegerType >
class lcm_evaluator;
} // namespace boost } // namespace boost

View File

@ -246,7 +246,7 @@ inline ostream& operator<<(ostream& os, unsigned __int64 i)
// GCD on signed integer types // GCD on signed integer types
template< class T > void gcd_int_test() // signed_test_types template< class T > void gcd_int_test() // signed_test_types
{ {
using boost::math::gcd; using boost::integer::gcd;
// Originally from Boost.Rational tests // Originally from Boost.Rational tests
BOOST_TEST_EQ( gcd<T>( 1, -1), static_cast<T>( 1) ); BOOST_TEST_EQ( gcd<T>( 1, -1), static_cast<T>( 1) );
@ -270,7 +270,7 @@ template< class T > void gcd_int_test() // signed_test_types
// GCD on unmarked signed integer type // GCD on unmarked signed integer type
void gcd_unmarked_int_test() void gcd_unmarked_int_test()
{ {
using boost::math::gcd; using boost::integer::gcd;
// The regular signed-integer GCD function performs the unsigned version, // The regular signed-integer GCD function performs the unsigned version,
// then does an absolute-value on the result. Signed types that are not // then does an absolute-value on the result. Signed types that are not
@ -297,7 +297,7 @@ void gcd_unmarked_int_test()
// GCD on unsigned integer types // GCD on unsigned integer types
template< class T > void gcd_unsigned_test() // unsigned_test_types template< class T > void gcd_unsigned_test() // unsigned_test_types
{ {
using boost::math::gcd; using boost::integer::gcd;
// Note that unmarked types (i.e. have no std::numeric_limits // Note that unmarked types (i.e. have no std::numeric_limits
// specialization) are treated like non/unsigned types // specialization) are treated like non/unsigned types
@ -314,7 +314,7 @@ template< class T > void gcd_unsigned_test() // unsigned_test_types
// GCD at compile-time // GCD at compile-time
void gcd_static_test() void gcd_static_test()
{ {
using boost::math::static_gcd; using boost::integer::static_gcd;
BOOST_TEST_EQ( (static_gcd< 1, 1>::value), 1 ); BOOST_TEST_EQ( (static_gcd< 1, 1>::value), 1 );
BOOST_TEST_EQ( (static_gcd< 0, 0>::value), 0 ); BOOST_TEST_EQ( (static_gcd< 0, 0>::value), 0 );
@ -336,7 +336,7 @@ void gcd_static_test()
// LCM on signed integer types // LCM on signed integer types
template< class T > void lcm_int_test() // signed_test_types template< class T > void lcm_int_test() // signed_test_types
{ {
using boost::math::lcm; using boost::integer::lcm;
// Originally from Boost.Rational tests // Originally from Boost.Rational tests
BOOST_TEST_EQ( lcm<T>( 1, -1), static_cast<T>( 1) ); BOOST_TEST_EQ( lcm<T>( 1, -1), static_cast<T>( 1) );
@ -360,7 +360,7 @@ template< class T > void lcm_int_test() // signed_test_types
// LCM on unmarked signed integer type // LCM on unmarked signed integer type
void lcm_unmarked_int_test() void lcm_unmarked_int_test()
{ {
using boost::math::lcm; using boost::integer::lcm;
// The regular signed-integer LCM function performs the unsigned version, // The regular signed-integer LCM function performs the unsigned version,
// then does an absolute-value on the result. Signed types that are not // then does an absolute-value on the result. Signed types that are not
@ -387,7 +387,7 @@ void lcm_unmarked_int_test()
// LCM on unsigned integer types // LCM on unsigned integer types
template< class T > void lcm_unsigned_test() // unsigned_test_types template< class T > void lcm_unsigned_test() // unsigned_test_types
{ {
using boost::math::lcm; using boost::integer::lcm;
// Note that unmarked types (i.e. have no std::numeric_limits // Note that unmarked types (i.e. have no std::numeric_limits
// specialization) are treated like non/unsigned types // specialization) are treated like non/unsigned types
@ -404,7 +404,7 @@ template< class T > void lcm_unsigned_test() // unsigned_test_types
// LCM at compile-time // LCM at compile-time
void lcm_static_test() void lcm_static_test()
{ {
using boost::math::static_lcm; using boost::integer::static_lcm;
BOOST_TEST_EQ( (static_lcm< 1, 1>::value), 1 ); BOOST_TEST_EQ( (static_lcm< 1, 1>::value), 1 );
BOOST_TEST_EQ( (static_lcm< 0, 0>::value), 0 ); BOOST_TEST_EQ( (static_lcm< 0, 0>::value), 0 );