]> git.proxmox.com Git - ceph.git/blobdiff - ceph/src/boost/boost/math/special_functions/round.hpp
update ceph source to reef 18.1.2
[ceph.git] / ceph / src / boost / boost / math / special_functions / round.hpp
index 9f07105f1cc25ea00b2dbf0504201893f8f1e3b1..7e23e159f99d5938bfb2462b7ea0dd302c523a17 100644 (file)
@@ -20,7 +20,7 @@ namespace boost{ namespace math{
 namespace detail{
 
 template <class T, class Policy>
-inline typename tools::promote_args<T>::type round(const T& v, const Policy& pol, const boost::false_type&)
+inline typename tools::promote_args<T>::type round(const T& v, const Policy& pol, const std::false_type&)
 {
    BOOST_MATH_STD_USING
       typedef typename tools::promote_args<T>::type result_type;
@@ -52,7 +52,7 @@ inline typename tools::promote_args<T>::type round(const T& v, const Policy& pol
    }
 }
 template <class T, class Policy>
-inline typename tools::promote_args<T>::type round(const T& v, const Policy&, const boost::true_type&)
+inline typename tools::promote_args<T>::type round(const T& v, const Policy&, const std::true_type&)
 {
    return v;
 }
@@ -62,7 +62,7 @@ inline typename tools::promote_args<T>::type round(const T& v, const Policy&, co
 template <class T, class Policy>
 inline typename tools::promote_args<T>::type round(const T& v, const Policy& pol)
 {
-   return detail::round(v, pol, boost::integral_constant<bool, detail::is_integer_for_rounding<T>::value>());
+   return detail::round(v, pol, std::integral_constant<bool, detail::is_integer_for_rounding<T>::value>());
 }
 template <class T>
 inline typename tools::promote_args<T>::type round(const T& v)
@@ -78,12 +78,17 @@ inline typename tools::promote_args<T>::type round(const T& v)
 // namespace as the UDT: these will then be found via argument
 // dependent lookup.  See our concept archetypes for examples.
 //
+// Non-standard numeric limits syntax "(std::numeric_limits<int>::max)()" 
+// is to avoid macro substiution from MSVC
+// https://stackoverflow.com/questions/27442885/syntax-error-with-stdnumeric-limitsmax
+//
 template <class T, class Policy>
 inline int iround(const T& v, const Policy& pol)
 {
    BOOST_MATH_STD_USING
+   typedef typename tools::promote_args<T>::type result_type;
    T r = boost::math::round(v, pol);
-   if((r > (std::numeric_limits<int>::max)()) || (r < (std::numeric_limits<int>::min)()))
+   if(r > static_cast<result_type>((std::numeric_limits<int>::max)()) || r < static_cast<result_type>((std::numeric_limits<int>::min)()))
       return static_cast<int>(policies::raise_rounding_error("boost::math::iround<%1%>(%1%)", 0, v, 0, pol));
    return static_cast<int>(r);
 }
@@ -97,8 +102,9 @@ template <class T, class Policy>
 inline long lround(const T& v, const Policy& pol)
 {
    BOOST_MATH_STD_USING
+   typedef typename tools::promote_args<T>::type result_type;
    T r = boost::math::round(v, pol);
-   if((r > (std::numeric_limits<long>::max)()) || (r < (std::numeric_limits<long>::min)()))
+   if(r > static_cast<result_type>((std::numeric_limits<long>::max)()) || r < static_cast<result_type>((std::numeric_limits<long>::min)()))
       return static_cast<long int>(policies::raise_rounding_error("boost::math::lround<%1%>(%1%)", 0, v, 0L, pol));
    return static_cast<long int>(r);
 }
@@ -108,25 +114,25 @@ inline long lround(const T& v)
    return lround(v, policies::policy<>());
 }
 
-#ifdef BOOST_HAS_LONG_LONG
-
 template <class T, class Policy>
-inline boost::long_long_type llround(const T& v, const Policy& pol)
+inline long long llround(const T& v, const Policy& pol)
 {
    BOOST_MATH_STD_USING
+   typedef typename tools::promote_args<T>::type result_type;
    T r = boost::math::round(v, pol);
-   if((r > (std::numeric_limits<boost::long_long_type>::max)()) || (r < (std::numeric_limits<boost::long_long_type>::min)()))
-      return static_cast<boost::long_long_type>(policies::raise_rounding_error("boost::math::llround<%1%>(%1%)", 0, v, static_cast<boost::long_long_type>(0), pol));
-   return static_cast<boost::long_long_type>(r);
+   if(r > static_cast<result_type>((std::numeric_limits<long long>::max)()) || 
+      r < static_cast<result_type>((std::numeric_limits<long long>::min)()))
+   {
+      return static_cast<long long>(policies::raise_rounding_error("boost::math::llround<%1%>(%1%)", 0, v, static_cast<long long>(0), pol));
+   }
+   return static_cast<long long>(r);
 }
 template <class T>
-inline boost::long_long_type llround(const T& v)
+inline long long llround(const T& v)
 {
    return llround(v, policies::policy<>());
 }
 
-#endif
-
 }} // namespaces
 
 #endif // BOOST_MATH_ROUND_HPP