[libcxx] r295559 - math: add type promoting template definition on MSVCRT
Saleem Abdulrasool via cfe-commits
cfe-commits at lists.llvm.org
Sat Feb 18 11:28:38 PST 2017
Author: compnerd
Date: Sat Feb 18 13:28:38 2017
New Revision: 295559
URL: http://llvm.org/viewvc/llvm-project?rev=295559&view=rev
Log:
math: add type promoting template definition on MSVCRT
When building with MSVCRT, we need to manually provide the type
promoting overloads to allow the correct type deduced invocation for
signbit(Int) and fpclassify(int).
Modified:
libcxx/trunk/include/math.h
Modified: libcxx/trunk/include/math.h
URL: http://llvm.org/viewvc/llvm-project/libcxx/trunk/include/math.h?rev=295559&r1=295558&r2=295559&view=diff
==============================================================================
--- libcxx/trunk/include/math.h (original)
+++ libcxx/trunk/include/math.h Sat Feb 18 13:28:38 2017
@@ -333,6 +333,16 @@ signbit(_A1 __lcpp_x) _NOEXCEPT
return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x);
}
+#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
+
+template <typename _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, bool>::type
+signbit(_A1 __lcpp_x) _NOEXCEPT
+{
+ return ::signbit(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
+}
+
#endif // signbit
// fpclassify
@@ -357,6 +367,16 @@ fpclassify(_A1 __lcpp_x) _NOEXCEPT
return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x);
}
+#elif defined(_LIBCPP_MSVCRT) && ((_VC_CRT_MAJOR_VERSION-0) >= 14)
+
+template <typename _A1>
+inline _LIBCPP_INLINE_VISIBILITY
+typename std::enable_if<std::is_arithmetic<_A1>::value, int>::type
+fpclassify(_A1 __lcpp_x) _NOEXCEPT
+{
+ return ::fpclassify(static_cast<typename std::__promote<_A1>::type>(__lcpp_x));
+}
+
#endif // fpclassify
// isfinite
More information about the cfe-commits
mailing list