[libcxx-commits] [libcxx] c702264 - [libc++][math.h] Remove some code duplication

Nikolas Klauser via libcxx-commits libcxx-commits at lists.llvm.org
Tue Nov 22 11:36:09 PST 2022


Author: Nikolas Klauser
Date: 2022-11-22T20:35:55+01:00
New Revision: c702264762e2d349209a2e474e2992bd090ab1a9

URL: https://github.com/llvm/llvm-project/commit/c702264762e2d349209a2e474e2992bd090ab1a9
DIFF: https://github.com/llvm/llvm-project/commit/c702264762e2d349209a2e474e2992bd090ab1a9.diff

LOG: [libc++][math.h] Remove some code duplication

Reviewed By: ldionne, #libc

Spies: libcxx-commits

Differential Revision: https://reviews.llvm.org/D137500

Added: 
    

Modified: 
    libcxx/include/math.h

Removed: 
    


################################################################################
diff  --git a/libcxx/include/math.h b/libcxx/include/math.h
index 94b0a619e0ab..c4cf661aff01 100644
--- a/libcxx/include/math.h
+++ b/libcxx/include/math.h
@@ -316,6 +316,7 @@ extern "C++" {
 
 #    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
@@ -337,34 +338,11 @@ inline _LIBCPP_HIDE_FROM_ABI
   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
@@ -378,22 +356,6 @@ fpclassify(_A1 __x) _NOEXCEPT {
   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


        


More information about the libcxx-commits mailing list