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).
llvm-svn: 295559
Cr-Mirrored-From: sso://chromium.googlesource.com/_direct/external/github.com/llvm/llvm-project
Cr-Mirrored-Commit: af14a631d0fcc7f5e6804571cca1c6f6876b10ca
diff --git a/include/math.h b/include/math.h
index 4644dd2..b765926 100644
--- a/include/math.h
+++ b/include/math.h
@@ -333,6 +333,16 @@
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 @@
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