X-Git-Url: https://git.donarmstrong.com/?p=rsem.git;a=blobdiff_plain;f=boost%2Fnumeric%2Fconversion%2Fdetail%2Fnumeric_cast_traits.hpp;fp=boost%2Fnumeric%2Fconversion%2Fdetail%2Fnumeric_cast_traits.hpp;h=150490d935fd3e95c537bda92b6b56206aeb0f54;hp=0000000000000000000000000000000000000000;hb=2d71eb92104693ca9baa5a2e1c23eeca776d8fd3;hpb=da57529b92adbb7ae74a89861cb39fb35ac7c62d diff --git a/boost/numeric/conversion/detail/numeric_cast_traits.hpp b/boost/numeric/conversion/detail/numeric_cast_traits.hpp new file mode 100644 index 0000000..150490d --- /dev/null +++ b/boost/numeric/conversion/detail/numeric_cast_traits.hpp @@ -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 + + #if !defined(BOOST_NO_LONG_LONG) + #include + #endif + +#else +#if !BOOST_PP_IS_ITERATING + + #include + #include + #include + + #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())), )) + #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())), )) + #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())), )) + #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 rounding_policy; + }; + + #undef BOOST_NUMERIC_CONVERSION_A + #undef BOOST_NUMERIC_CONVERSION_B + +#endif//! Depth 2. +#endif// BOOST_NUMERIC_CONVERSION_DONT_USE_PREPROCESSED_FILES