Updated Boost libraries to version 1.49, and recompiled them with NDK r8d
This commit is contained in:
@@ -16,6 +16,7 @@
|
||||
// 30 Oct 2001 Some fixes suggested by Daryle Walker (Fernando Cacciola)
|
||||
// 25 Oct 2001 Initial boostification (Fernando Cacciola)
|
||||
// 23 Jan 2004 Inital add to cvs (post review)s
|
||||
// 22 Jun 2011 Added support for specializing cast policies via numeric_cast_traits (Brandon Kohn).
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
|
||||
#define BOOST_NUMERIC_CONVERSION_CAST_25OCT2001_HPP
|
||||
@@ -30,22 +31,31 @@
|
||||
|
||||
#include <boost/type.hpp>
|
||||
#include <boost/numeric/conversion/converter.hpp>
|
||||
#include <boost/numeric/conversion/numeric_cast_traits.hpp>
|
||||
|
||||
namespace boost
|
||||
{
|
||||
template<typename Target, typename Source>
|
||||
inline
|
||||
Target numeric_cast ( Source arg )
|
||||
{
|
||||
typedef boost::numeric::converter<Target,Source> Converter ;
|
||||
return Converter::convert(arg);
|
||||
}
|
||||
|
||||
using numeric::bad_numeric_cast;
|
||||
|
||||
template <typename Target, typename Source>
|
||||
inline Target numeric_cast( Source arg )
|
||||
{
|
||||
typedef numeric::conversion_traits<Target, Source> conv_traits;
|
||||
typedef numeric::numeric_cast_traits<Target, Source> cast_traits;
|
||||
typedef boost::numeric::converter
|
||||
<
|
||||
Target,
|
||||
Source,
|
||||
conv_traits,
|
||||
typename cast_traits::overflow_policy,
|
||||
typename cast_traits::rounding_policy,
|
||||
boost::numeric::raw_converter< conv_traits >,
|
||||
typename cast_traits::range_checking_policy
|
||||
> converter;
|
||||
return converter::convert(arg);
|
||||
}
|
||||
|
||||
using numeric::bad_numeric_cast;
|
||||
} // namespace boost
|
||||
|
||||
#endif
|
||||
|
||||
|
||||
#endif
|
||||
|
||||
@@ -0,0 +1,138 @@
|
||||
//
|
||||
//! Copyright (c) 2011-2012
|
||||
//! Brandon Kohn
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
|
||||
#if !defined(BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES)
|
||||
|
||||
#include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_common.hpp>
|
||||
|
||||
#if !defined(BOOST_NO_LONG_LONG)
|
||||
#include <boost/numeric/conversion/detail/preprocessed/numeric_cast_traits_long_long.hpp>
|
||||
#endif
|
||||
|
||||
#else
|
||||
#if !BOOST_PP_IS_ITERATING
|
||||
|
||||
#include <boost/preprocessor/seq/elem.hpp>
|
||||
#include <boost/preprocessor/seq/size.hpp>
|
||||
#include <boost/preprocessor/iteration/iterate.hpp>
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_common.hpp")
|
||||
#endif
|
||||
//
|
||||
//! Copyright (c) 2011-2012
|
||||
//! Brandon Kohn
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
//! These are the assumed common built in fundamental types (not typedefs/macros.)
|
||||
#define BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES() \
|
||||
(char) \
|
||||
(signed char) \
|
||||
(unsigned char) \
|
||||
(short) \
|
||||
(unsigned short) \
|
||||
(int) \
|
||||
(unsigned int) \
|
||||
(long) \
|
||||
(unsigned long) \
|
||||
(float) \
|
||||
(double) \
|
||||
(long double) \
|
||||
/***/
|
||||
|
||||
#define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
|
||||
#define BOOST_NUMERIC_CONVERSION_SEQ_B() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()
|
||||
|
||||
namespace boost { namespace numeric {
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}//namespace boost::numeric;
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#if ( defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES) ) || !defined(BOOST_NO_LONG_LONG)
|
||||
|
||||
#undef BOOST_NUMERIC_CONVERSION_SEQ_A
|
||||
#undef BOOST_NUMERIC_CONVERSION_SEQ_B
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 2, line: 0, output: "preprocessed/numeric_cast_traits_long_long.hpp")
|
||||
#endif
|
||||
|
||||
//
|
||||
//! Copyright (c) 2011-2012
|
||||
//! Brandon Kohn
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(preserve: 1)
|
||||
#endif
|
||||
|
||||
namespace boost { namespace numeric {
|
||||
|
||||
#define BOOST_NUMERIC_CONVERSION_SEQ_A() BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES()(boost::long_long_type)(boost::ulong_long_type)
|
||||
#define BOOST_NUMERIC_CONVERSION_SEQ_B() (boost::long_long_type)(boost::ulong_long_type)
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_1 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_A())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
}}//namespace boost::numeric;
|
||||
|
||||
#if defined(__WAVE__) && defined(BOOST_NUMERIC_CONVERSION_CREATE_PREPROCESSED_FILES)
|
||||
#pragma wave option(output: null)
|
||||
#endif
|
||||
|
||||
#endif
|
||||
|
||||
#undef BOOST_NUMERIC_CONVERSION_BASE_BUILTIN_TYPES
|
||||
#undef BOOST_NUMERIC_CONVERSION_SEQ_A
|
||||
#undef BOOST_NUMERIC_CONVERSION_SEQ_B
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 1
|
||||
|
||||
#define BOOST_PP_ITERATION_PARAMS_2 (3, (0, BOOST_PP_DEC(BOOST_PP_SEQ_SIZE(BOOST_NUMERIC_CONVERSION_SEQ_B())), <boost/numeric/conversion/detail/numeric_cast_traits.hpp>))
|
||||
#include BOOST_PP_ITERATE()
|
||||
|
||||
#elif BOOST_PP_ITERATION_DEPTH() == 2
|
||||
|
||||
//! Generate default traits for the specified source and target.
|
||||
#define BOOST_NUMERIC_CONVERSION_A BOOST_PP_FRAME_ITERATION(1)
|
||||
#define BOOST_NUMERIC_CONVERSION_B BOOST_PP_FRAME_ITERATION(2)
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_A, BOOST_NUMERIC_CONVERSION_SEQ_A())
|
||||
, BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<BOOST_PP_SEQ_ELEM(BOOST_NUMERIC_CONVERSION_B, BOOST_NUMERIC_CONVERSION_SEQ_B())> rounding_policy;
|
||||
};
|
||||
|
||||
#undef BOOST_NUMERIC_CONVERSION_A
|
||||
#undef BOOST_NUMERIC_CONVERSION_B
|
||||
|
||||
#endif//! Depth 2.
|
||||
#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES
|
||||
File diff suppressed because it is too large
Load Diff
@@ -0,0 +1,347 @@
|
||||
//
|
||||
//! Copyright (c) 2011-2012
|
||||
//! Brandon Kohn
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
namespace boost { namespace numeric {
|
||||
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
char
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
char
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
signed char
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
signed char
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned char
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned char
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
short
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
short
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned short
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned short
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
int
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
int
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned int
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned int
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
long
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
long
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned long
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
unsigned long
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
float
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
float
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
double
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
double
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
long double
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
long double
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
boost::long_long_type
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
boost::long_long_type
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
boost::ulong_long_type
|
||||
, boost::long_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::long_long_type> rounding_policy;
|
||||
};
|
||||
|
||||
template <>
|
||||
struct numeric_cast_traits
|
||||
<
|
||||
boost::ulong_long_type
|
||||
, boost::ulong_long_type
|
||||
>
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<boost::ulong_long_type> rounding_policy;
|
||||
};
|
||||
}}
|
||||
@@ -0,0 +1,31 @@
|
||||
//
|
||||
//! Copyright (c) 2011
|
||||
//! Brandon Kohn
|
||||
//
|
||||
// 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)
|
||||
//
|
||||
#ifndef BOOST_NUMERIC_CAST_TRAITS_HPP
|
||||
#define BOOST_NUMERIC_CAST_TRAITS_HPP
|
||||
|
||||
#include <boost/numeric/conversion/converter_policies.hpp>
|
||||
|
||||
namespace boost { namespace numeric {
|
||||
|
||||
template <typename Target, typename Source, typename EnableIf = void>
|
||||
struct numeric_cast_traits
|
||||
{
|
||||
typedef def_overflow_handler overflow_policy;
|
||||
typedef UseInternalRangeChecker range_checking_policy;
|
||||
typedef Trunc<Source> rounding_policy;
|
||||
};
|
||||
|
||||
}}//namespace boost::numeric;
|
||||
|
||||
#if !defined( BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS )
|
||||
#include <boost/cstdint.hpp>
|
||||
#include <boost/numeric/conversion/detail/numeric_cast_traits.hpp>
|
||||
#endif//!defined BOOST_NUMERIC_CONVERSION_RELAX_BUILT_IN_CAST_TRAITS
|
||||
|
||||
#endif//BOOST_NUMERIC_CAST_TRAITS_HPP
|
||||
@@ -185,7 +185,7 @@ interval<T, Policies> pow(const interval<T, Policies>& x, int pwr)
|
||||
return I(yl, yu, true);
|
||||
} else if (interval_lib::user::is_neg(x.lower())) { // [-1,1]
|
||||
if (pwr & 1) { // [-1,1]^1
|
||||
return I(-pow_up(-x.lower(), pwr, rnd), pow_up(x.upper(), pwr, rnd), true);
|
||||
return I(-pow_up(static_cast<T>(-x.lower()), pwr, rnd), pow_up(x.upper(), pwr, rnd), true);
|
||||
} else { // [-1,1]^2
|
||||
return I(static_cast<T>(0), pow_up(max BOOST_PREVENT_MACRO_SUBSTITUTION(static_cast<T>(-x.lower()), x.upper()), pwr, rnd), true);
|
||||
}
|
||||
|
||||
@@ -16,27 +16,30 @@
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
namespace interval_lib {
|
||||
namespace detail {
|
||||
|
||||
struct c99_rounding_control: c99_rounding
|
||||
{
|
||||
template<class T>
|
||||
static T force_rounding(const T& r) { volatile T r_ = r; return r_; }
|
||||
};
|
||||
|
||||
} // namespace detail
|
||||
|
||||
template<>
|
||||
struct rounding_control<float>:
|
||||
detail::c99_rounding_control { };
|
||||
detail::c99_rounding_control
|
||||
{
|
||||
static float force_rounding(float const &r)
|
||||
{ volatile float r_ = r; return r_; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<double>:
|
||||
detail::c99_rounding_control { };
|
||||
detail::c99_rounding_control
|
||||
{
|
||||
static double force_rounding(double const &r)
|
||||
{ volatile double r_ = r; return r_; }
|
||||
};
|
||||
|
||||
template<>
|
||||
struct rounding_control<long double>:
|
||||
detail::c99_rounding_control { };
|
||||
detail::c99_rounding_control
|
||||
{
|
||||
static long double force_rounding(long double const &r)
|
||||
{ volatile long double r_ = r; return r_; }
|
||||
};
|
||||
|
||||
} // namespace interval_lib
|
||||
} // namespace numeric
|
||||
|
||||
@@ -11,7 +11,7 @@
|
||||
#ifndef BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
|
||||
#define BOOST_NUMERIC_INTERVAL_DETAIL_C99SUB_ROUNDING_CONTROL_HPP
|
||||
|
||||
#include <fenv.h> // ISO C 99 rounding mode control
|
||||
#include <boost/detail/fenv.hpp> // ISO C 99 rounding mode control
|
||||
|
||||
namespace boost {
|
||||
namespace numeric {
|
||||
@@ -20,11 +20,11 @@ namespace detail {
|
||||
|
||||
extern "C" { double rint(double); }
|
||||
|
||||
struct c99_rounding
|
||||
struct c99_rounding_control
|
||||
{
|
||||
typedef int rounding_mode;
|
||||
|
||||
static void set_rounding_mode(const rounding_mode mode) { fesetround(mode); }
|
||||
static void set_rounding_mode(rounding_mode mode) { fesetround(mode); }
|
||||
static void get_rounding_mode(rounding_mode &mode) { mode = fegetround(); }
|
||||
static void downward() { set_rounding_mode(FE_DOWNWARD); }
|
||||
static void upward() { set_rounding_mode(FE_UPWARD); }
|
||||
|
||||
@@ -25,7 +25,16 @@ namespace numeric {
|
||||
namespace interval_lib {
|
||||
namespace detail {
|
||||
|
||||
#if BOOST_MSVC < 1400 || defined(WIN64)
|
||||
extern "C" { double rint(double); }
|
||||
#else
|
||||
inline double rint(double x)
|
||||
{
|
||||
_asm FLD [x] ;
|
||||
_asm FRNDINT ;
|
||||
//_asm RET ;
|
||||
}
|
||||
#endif
|
||||
|
||||
struct x86_rounding
|
||||
{
|
||||
|
||||
@@ -17,7 +17,7 @@
|
||||
# include <boost/numeric/interval/detail/bcc_rounding_control.hpp>
|
||||
#elif defined(_MSC_VER)
|
||||
# include <boost/numeric/interval/detail/msvc_rounding_control.hpp>
|
||||
#elif defined(__MWERKS__) || defined(__ICC)
|
||||
#elif defined(__MWERKS__) || defined(__ICC) || defined (__SUNPRO_CC)
|
||||
# define BOOST_NUMERIC_INTERVAL_USE_C99_SUBSYSTEM
|
||||
# include <boost/numeric/interval/detail/c99sub_rounding_control.hpp>
|
||||
#else
|
||||
@@ -31,7 +31,7 @@ namespace interval_lib {
|
||||
namespace detail {
|
||||
|
||||
#ifdef BOOST_NUMERIC_INTERVAL_USE_C99_SUBSYSTEM
|
||||
typedef c99_rounding x86_rounding_control;
|
||||
typedef c99_rounding_control x86_rounding_control;
|
||||
#undef BOOST_NUMERIC_INTERVAL_USE_C99_SUBSYSTEM
|
||||
#else
|
||||
struct fpu_rounding_modes
|
||||
|
||||
@@ -176,7 +176,7 @@ interval<T, Policies> cosh(const interval<T, Policies>& x)
|
||||
else if (!interval_lib::user::is_neg(x.lower()))
|
||||
return I(rnd.cosh_down(x.lower()), rnd.cosh_up(x.upper()), true);
|
||||
else
|
||||
return I(static_cast<T>(0), rnd.cosh_up(-x.lower() > x.upper() ? x.lower() : x.upper()), true);
|
||||
return I(static_cast<T>(1), rnd.cosh_up(-x.lower() > x.upper() ? x.lower() : x.upper()), true);
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
|
||||
@@ -144,8 +144,8 @@ bool overlap(const interval<T, Policies1>& x,
|
||||
const interval<T, Policies2>& y)
|
||||
{
|
||||
if (interval_lib::detail::test_input(x, y)) return false;
|
||||
return x.lower() <= y.lower() && y.lower() <= x.upper() ||
|
||||
y.lower() <= x.lower() && x.lower() <= y.upper();
|
||||
return (x.lower() <= y.lower() && y.lower() <= x.upper()) ||
|
||||
(y.lower() <= x.lower() && x.lower() <= y.upper());
|
||||
}
|
||||
|
||||
template<class T, class Policies> inline
|
||||
|
||||
Reference in New Issue
Block a user