[libcxx-commits] [PATCH] D137500: [libc++][math.h] Remove some code duplication
Nikolas Klauser via Phabricator via libcxx-commits
libcxx-commits at lists.llvm.org
Sat Nov 5 13:55:03 PDT 2022
philnik created this revision.
philnik added reviewers: ldionne, Mordante, var-const, huixie90.
Herald added a project: All.
philnik requested review of this revision.
Herald added a project: libc++.
Herald added a subscriber: libcxx-commits.
Herald added a reviewer: libc++.
Repository:
rG LLVM Github Monorepo
https://reviews.llvm.org/D137500
Files:
libcxx/include/math.h
Index: libcxx/include/math.h
===================================================================
--- libcxx/include/math.h
+++ libcxx/include/math.h
@@ -314,6 +314,7 @@
# ifdef signbit
# undef signbit
+# endif // signbit
template <class _A1>
inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
@@ -335,34 +336,11 @@
return false;
}
-# elif defined(_LIBCPP_MSVCRT)
-
-template <typename _A1>
-inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-signbit(_A1 __x) _NOEXCEPT {
- return ::signbit(__x);
-}
-
-template <class _A1>
-inline _LIBCPP_HIDE_FROM_ABI
- typename std::enable_if< std::is_integral<_A1>::value && std::is_signed<_A1>::value, bool>::type
- signbit(_A1 __x) _NOEXCEPT {
- return __x < 0;
-}
-
-template <class _A1>
-inline _LIBCPP_HIDE_FROM_ABI
- typename std::enable_if< std::is_integral<_A1>::value && !std::is_signed<_A1>::value, bool>::type
- signbit(_A1) _NOEXCEPT {
- return false;
-}
-
-# endif // signbit
-
// fpclassify
# ifdef fpclassify
# undef fpclassify
+# endif // fpclassify
template <class _A1>
inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_floating_point<_A1>::value, int>::type
@@ -376,22 +354,6 @@
return __x == 0 ? FP_ZERO : FP_NORMAL;
}
-# elif defined(_LIBCPP_MSVCRT)
-
-template <typename _A1>
-inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_floating_point<_A1>::value, bool>::type
-fpclassify(_A1 __x) _NOEXCEPT {
- return ::fpclassify(__x);
-}
-
-template <class _A1>
-inline _LIBCPP_HIDE_FROM_ABI typename std::enable_if<std::is_integral<_A1>::value, int>::type
-fpclassify(_A1 __x) _NOEXCEPT {
- return __x == 0 ? FP_ZERO : FP_NORMAL;
-}
-
-# endif // fpclassify
-
// isfinite
# ifdef isfinite
-------------- next part --------------
A non-text attachment was scrubbed...
Name: D137500.473463.patch
Type: text/x-patch
Size: 1851 bytes
Desc: not available
URL: <http://lists.llvm.org/pipermail/libcxx-commits/attachments/20221105/c730b7d2/attachment.bin>
More information about the libcxx-commits
mailing list