diff --git a/libcxx/include/math.h b/libcxx/include/math.h --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -312,11 +312,56 @@ #include #include -// signbit + +# ifdef fpclassify +# undef fpclassify +# endif # ifdef signbit # undef signbit -# endif // signbit +# endif + +# ifdef isfinite +# undef isfinite +# endif + +# ifdef isinf +# undef isinf +# endif + +# ifdef isnan +# undef isnan +# endif + +# ifdef isnormal +# undef isnormal +# endif + +# ifdef isgreater +# undef isgreater +# endif + +# ifdef isgreaterequal +# undef isgreaterequal +# endif + +# ifdef isless +# undef isless +# endif + +# ifdef islessequal +# undef islessequal +# endif + +# ifdef islessgreater +# undef islessgreater +# endif + +# ifdef isunordered +# undef isunordered +# endif + +// signbit template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool signbit(_A1 __x) _NOEXCEPT { @@ -335,10 +380,6 @@ // fpclassify -# ifdef fpclassify -# undef fpclassify -# endif // fpclassify - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI int fpclassify(_A1 __x) _NOEXCEPT { return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __x); @@ -349,10 +390,10 @@ return __x == 0 ? FP_ZERO : FP_NORMAL; } -// isfinite +// The MSVC runtime already provides these functions as templates +#ifndef _LIBCPP_MSVCRT -# ifdef isfinite -# undef isfinite +// isfinite template ::value && std::numeric_limits<_A1>::has_infinity, int> = 0> @@ -366,13 +407,8 @@ return true; } -# endif // isfinite - // isinf -# ifdef isinf -# undef isinf - template ::value && std::numeric_limits<_A1>::has_infinity, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isinf(_A1 __x) _NOEXCEPT { @@ -394,13 +430,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool isinf(long double __x) _NOEXCEPT { return __builtin_isinf(__x); } # endif -# endif // isinf - // isnan -# ifdef isnan -# undef isnan - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isnan(_A1 __x) _NOEXCEPT { return __builtin_isnan(__x); @@ -419,13 +450,8 @@ inline _LIBCPP_HIDE_FROM_ABI bool isnan(long double __x) _NOEXCEPT { return __builtin_isnan(__x); } # endif -# endif // isnan - // isnormal -# ifdef isnormal -# undef isnormal - template ::value, int> = 0> inline _LIBCPP_HIDE_FROM_ABI bool isnormal(_A1 __x) _NOEXCEPT { return __builtin_isnormal(__x); @@ -436,13 +462,8 @@ return __x != 0; } -# endif // isnormal - // isgreater -# ifdef isgreater -# undef isgreater - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -451,13 +472,8 @@ return __builtin_isgreater((type)__x, (type)__y); } -# endif // isgreater - // isgreaterequal -# ifdef isgreaterequal -# undef isgreaterequal - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -466,13 +482,8 @@ return __builtin_isgreaterequal((type)__x, (type)__y); } -# endif // isgreaterequal - // isless -# ifdef isless -# undef isless - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -481,13 +492,8 @@ return __builtin_isless((type)__x, (type)__y); } -# endif // isless - // islessequal -# ifdef islessequal -# undef islessequal - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -496,13 +502,8 @@ return __builtin_islessequal((type)__x, (type)__y); } -# endif // islessequal - // islessgreater -# ifdef islessgreater -# undef islessgreater - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -511,13 +512,8 @@ return __builtin_islessgreater((type)__x, (type)__y); } -# endif // islessgreater - // isunordered -# ifdef isunordered -# undef isunordered - template ::value && std::is_arithmetic<_A2>::value, int> = 0> @@ -526,7 +522,7 @@ return __builtin_isunordered((type)__x, (type)__y); } -# endif // isunordered +#endif // _LIBCPP_MSVCRT // abs //