diff --git a/libcxx/include/math.h b/libcxx/include/math.h --- a/libcxx/include/math.h +++ b/libcxx/include/math.h @@ -301,485 +301,209 @@ # include_next # endif -#ifdef __cplusplus - -// We support including .h headers inside 'extern "C"' contexts, so switch -// back to C++ linkage before including these C++ headers. -extern "C++" { - -#include <__type_traits/promote.h> -#include -#include -#include - -// signbit - #ifdef signbit - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_signbit(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_signbit) - return __builtin_signbit(__x); -#else - return signbit(__x); +# undef signbit #endif -} - -#undef signbit - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ - return __libcpp_signbit(__x); -} - -template -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 -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; } - -#elif defined(_LIBCPP_MSVCRT) - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -signbit(_A1 __x) _NOEXCEPT -{ - return ::signbit(__x); -} - -template -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 -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 - -template -_LIBCPP_HIDE_FROM_ABI -int -__libcpp_fpclassify(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_fpclassify) - return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, - FP_ZERO, __x); -#else - return fpclassify(__x); +# undef fpclassify #endif -} - -#undef fpclassify - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ - return __libcpp_fpclassify(__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ return __x == 0 ? FP_ZERO : FP_NORMAL; } - -#elif defined(_LIBCPP_MSVCRT) - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -fpclassify(_A1 __x) _NOEXCEPT -{ - return ::fpclassify(__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, int>::type -fpclassify(_A1 __x) _NOEXCEPT -{ return __x == 0 ? FP_ZERO : FP_NORMAL; } - -#endif // fpclassify - -// isfinite #ifdef isfinite - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isfinite(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isfinite) - return __builtin_isfinite(__x); -#else - return isfinite(__x); +# undef isfinite #endif -} - -#undef isfinite - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1 __x) _NOEXCEPT -{ - return __libcpp_isfinite((typename std::__promote<_A1>::type)__x); -} - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isfinite(_A1) _NOEXCEPT -{ return true; } - -#endif // isfinite - -// isinf #ifdef isinf +# undef isinf +#endif -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isinf(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isinf) - return __builtin_isinf(__x); -#else - return isinf(__x); +#ifdef isnan +# undef isnan #endif -} -#undef isinf +#ifdef isnormal +# undef isnormal +#endif -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if< - std::is_arithmetic<_A1>::value && std::numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1 __x) _NOEXCEPT -{ - return __libcpp_isinf((typename std::__promote<_A1>::type)__x); -} +#ifdef isless +# undef isless +#endif -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if< - std::is_arithmetic<_A1>::value && !std::numeric_limits<_A1>::has_infinity, - bool>::type -isinf(_A1) _NOEXCEPT -{ return false; } +#ifdef islessequal +# undef islessequal +#endif -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_HIDE_FROM_ABI -bool -isinf(float __x) _NOEXCEPT { return __libcpp_isinf(__x); } +#ifdef islessgreater +# undef islessgreater +#endif -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD -bool -isinf(double __x) _NOEXCEPT { return __libcpp_isinf(__x); } +#ifdef isgreaterequal +# undef isgreaterequal +#endif -inline _LIBCPP_HIDE_FROM_ABI -bool -isinf(long double __x) _NOEXCEPT { return __libcpp_isinf(__x); } +#ifdef isgreater +# undef isgreater #endif -#endif // isinf +#ifdef isunordered +# undef isunordered +#endif -// isnan +#ifdef isfinite +# undef isfinite +#endif #ifdef isnan - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isnan(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnan) - return __builtin_isnan(__x); -#else - return isnan(__x); +# undef isnan #endif -} - -#undef isnan - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -isnan(_A1 __x) _NOEXCEPT -{ - return __libcpp_isnan(__x); -} -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -isnan(_A1) _NOEXCEPT -{ return false; } - -#ifdef _LIBCPP_PREFERRED_OVERLOAD -inline _LIBCPP_HIDE_FROM_ABI -bool -isnan(float __x) _NOEXCEPT { return __libcpp_isnan(__x); } - -inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD -bool -isnan(double __x) _NOEXCEPT { return __libcpp_isnan(__x); } - -inline _LIBCPP_HIDE_FROM_ABI -bool -isnan(long double __x) _NOEXCEPT { return __libcpp_isnan(__x); } +#ifdef isnormal +# undef isnormal #endif -#endif // isnan +#ifdef __cplusplus -// isnormal +// We support including .h headers inside 'extern "C"' contexts, so switch +// back to C++ linkage before including these C++ headers. +extern "C++" { -#ifdef isnormal +#include <__type_traits/promote.h> +#include +#include +#include -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isnormal(_A1 __x) _NOEXCEPT -{ -#if __has_builtin(__builtin_isnormal) - return __builtin_isnormal(__x); -#else - return isnormal(__x); -#endif +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool signbit(_Tp __v) _NOEXCEPT { + return __builtin_signbit(__v); } -#undef isnormal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -isnormal(_A1 __x) _NOEXCEPT -{ - return __libcpp_isnormal(__x); +template ::value && std::is_signed<_Tp>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool signbit(_Tp __v) _NOEXCEPT { + return __v < 0; } -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if::value, bool>::type -isnormal(_A1 __x) _NOEXCEPT -{ return __x != 0; } - -#endif // isnormal - -// isgreater - -#ifdef isgreater - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isgreater(__x, __y); +template ::value && !std::is_signed<_Tp>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool signbit(_Tp) _NOEXCEPT { + return false; } -#undef isgreater - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreater((type)__x, (type)__y); +#ifndef _LIBCPP_MSVCRT +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI int fpclassify(_Tp __v) _NOEXCEPT { + return __builtin_fpclassify(FP_NAN, FP_INFINITE, FP_NORMAL, FP_SUBNORMAL, FP_ZERO, __v); } +#endif // _LIBCPP_MSVCRT -#endif // isgreater - -// isgreaterequal - -#ifdef isgreaterequal - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isgreaterequal(__x, __y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI int fpclassify(_Tp __v) _NOEXCEPT { + return __v == 0 ? FP_ZERO : FP_NORMAL; } -#undef isgreaterequal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreaterequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreaterequal((type)__x, (type)__y); +#ifndef _LIBCPP_MSVCRT +template ::value && std::numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isfinite(_Tp __v) _NOEXCEPT { + return __builtin_isfinite(__v); } -#endif // isgreaterequal - -// isless - -#ifdef isless - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isless(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isless(__x, __y); +template ::value && !std::numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isfinite(_Tp) _NOEXCEPT { + return true; } -#undef isless - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isless(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isless((type)__x, (type)__y); +template ::value && std::numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isinf(_Tp __v) _NOEXCEPT { + return __builtin_isinf(__v); } -#endif // isless - -// islessequal - -#ifdef islessequal - -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_islessequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - return islessequal(__x, __y); +template ::value && !std::numeric_limits<_Tp>::has_infinity, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isinf(_Tp) _NOEXCEPT { + return false; } -#undef islessequal - -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessequal(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessequal((type)__x, (type)__y); +# ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isinf(double __v) _NOEXCEPT { + return __builtin_isinf(__v); } +# endif -#endif // islessequal - -// islessgreater +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnan(_Tp __v) _NOEXCEPT { + return __builtin_isnan(__v); +} -#ifdef islessgreater +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnan(_Tp) _NOEXCEPT { + return false; +} -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_islessgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - return islessgreater(__x, __y); +# ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_PREFERRED_OVERLOAD bool isnan(double __v) _NOEXCEPT { + return __builtin_isnan(__v); } +# endif // _LIBCPP_PREFERRED_OVERLOAD -#undef islessgreater +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnormal(_Tp __v) _NOEXCEPT { + return __builtin_isnormal(__v); +} -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessgreater(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessgreater((type)__x, (type)__y); +template ::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isnormal(_Tp __v) _NOEXCEPT { + return __v != 0; } -#endif // islessgreater +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isless(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_isless(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); +} -// isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool islessequal(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_islessequal(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); +} -#ifdef isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool islessgreater(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_islessgreater(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); +} -template -_LIBCPP_HIDE_FROM_ABI -bool -__libcpp_isunordered(_A1 __x, _A2 __y) _NOEXCEPT -{ - return isunordered(__x, __y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isgreaterequal(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_isgreaterequal(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); } -#undef isunordered +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isgreater(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_isgreater(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); +} -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isunordered(_A1 __x, _A2 __y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isunordered((type)__x, (type)__y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +_LIBCPP_HIDE_FROM_ABI bool isunordered(_Tp __lhs, _Up __rhs) _NOEXCEPT { + using __promote_to = typename std::__promote<_Tp, _Up>::type; + return __builtin_isunordered(static_cast<__promote_to>(__lhs), static_cast<__promote_to>(__rhs)); } -#endif // isunordered +#endif // _LIBCPP_MSVCRT // abs // @@ -1123,79 +847,25 @@ // copysign -#if __has_builtin(__builtin_copysignf) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI float __libcpp_copysign(float __x, float __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignf) +inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { return __builtin_copysignf(__x, __y); -#else - return ::copysignf(__x, __y); -#endif } -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI double __libcpp_copysign(double __x, double __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysign) +template +_LIBCPP_HIDE_FROM_ABI double copysign(double __x, double __y) _NOEXCEPT { return __builtin_copysign(__x, __y); -#else - return ::copysign(__x, __y); -#endif -} - -#if __has_builtin(__builtin_copysignl) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI long double __libcpp_copysign(long double __x, long double __y) _NOEXCEPT { -#if __has_builtin(__builtin_copysignl) - return __builtin_copysignl(__x, __y); -#else - return ::copysignl(__x, __y); -#endif -} - -template -#if __has_builtin(__builtin_copysign) -_LIBCPP_CONSTEXPR -#endif -inline _LIBCPP_HIDE_FROM_ABI -typename std::__enable_if_t -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - std::__promote<_A1, _A2> ->::type -__libcpp_copysign(_A1 __x, _A2 __y) _NOEXCEPT { - typedef typename std::__promote<_A1, _A2>::type __result_type; - static_assert((!(std::_IsSame<_A1, __result_type>::value && - std::_IsSame<_A2, __result_type>::value)), ""); -#if __has_builtin(__builtin_copysign) - return __builtin_copysign((__result_type)__x, (__result_type)__y); -#else - return ::copysign((__result_type)__x, (__result_type)__y); -#endif -} - -inline _LIBCPP_HIDE_FROM_ABI float copysign(float __x, float __y) _NOEXCEPT { - return ::__libcpp_copysign(__x, __y); } inline _LIBCPP_HIDE_FROM_ABI long double copysign(long double __x, long double __y) _NOEXCEPT { - return ::__libcpp_copysign(__x, __y); + return __builtin_copysignl(__x, __y); } -template -inline _LIBCPP_HIDE_FROM_ABI -typename std::__enable_if_t -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - std::__promote<_A1, _A2> ->::type - copysign(_A1 __x, _A2 __y) _NOEXCEPT { - return ::__libcpp_copysign(__x, __y); +template ::value && std::is_arithmetic<_Up>::value, int> = 0> +inline _LIBCPP_HIDE_FROM_ABI typename std::__promote<_Tp, _Up>::type copysign(_Tp __x, _Up __y) _NOEXCEPT { + using __result_type = typename std::__promote<_Tp, _Up>::type; + return ::copysign(static_cast<__result_type>(__x), static_cast<__result_type>(__y)); } // erf @@ -1263,19 +933,11 @@ inline _LIBCPP_HIDE_FROM_ABI float fma(float __x, float __y, float __z) _NOEXCEPT { -#if __has_builtin(__builtin_fmaf) return __builtin_fmaf(__x, __y, __z); -#else - return ::fmaf(__x, __y, __z); -#endif } inline _LIBCPP_HIDE_FROM_ABI long double fma(long double __x, long double __y, long double __z) _NOEXCEPT { -#if __has_builtin(__builtin_fmal) return __builtin_fmal(__x, __y, __z); -#else - return ::fmal(__x, __y, __z); -#endif } template @@ -1293,11 +955,7 @@ static_assert((!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value && std::_IsSame<_A3, __result_type>::value)), ""); -#if __has_builtin(__builtin_fma) return __builtin_fma((__result_type)__x, (__result_type)__y, (__result_type)__z); -#else - return ::fma((__result_type)__x, (__result_type)__y, (__result_type)__z); -#endif } // fmax @@ -1387,19 +1045,11 @@ inline _LIBCPP_HIDE_FROM_ABI long long llrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintf) return __builtin_llrintf(__x); -#else - return ::llrintf(__x); -#endif } inline _LIBCPP_HIDE_FROM_ABI long long llrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrintl) return __builtin_llrintl(__x); -#else - return ::llrintl(__x); -#endif } template @@ -1407,30 +1057,18 @@ typename std::enable_if::value, long long>::type llrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llrint) return __builtin_llrint((double)__x); -#else - return ::llrint((double)__x); -#endif } // llround inline _LIBCPP_HIDE_FROM_ABI long long llround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundf) return __builtin_llroundf(__x); -#else - return ::llroundf(__x); -#endif } inline _LIBCPP_HIDE_FROM_ABI long long llround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_llroundl) return __builtin_llroundl(__x); -#else - return ::llroundl(__x); -#endif } template @@ -1438,11 +1076,7 @@ typename std::enable_if::value, long long>::type llround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_llround) return __builtin_llround((double)__x); -#else - return ::llround((double)__x); -#endif } // log1p @@ -1479,19 +1113,11 @@ inline _LIBCPP_HIDE_FROM_ABI long lrint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintf) return __builtin_lrintf(__x); -#else - return ::lrintf(__x); -#endif } inline _LIBCPP_HIDE_FROM_ABI long lrint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrintl) return __builtin_lrintl(__x); -#else - return ::lrintl(__x); -#endif } template @@ -1499,30 +1125,18 @@ typename std::enable_if::value, long>::type lrint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lrint) return __builtin_lrint((double)__x); -#else - return ::lrint((double)__x); -#endif } // lround inline _LIBCPP_HIDE_FROM_ABI long lround(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundf) return __builtin_lroundf(__x); -#else - return ::lroundf(__x); -#endif } inline _LIBCPP_HIDE_FROM_ABI long lround(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_lroundl) return __builtin_lroundl(__x); -#else - return ::lroundl(__x); -#endif } template @@ -1530,11 +1144,7 @@ typename std::enable_if::value, long>::type lround(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_lround) return __builtin_lround((double)__x); -#else - return ::lround((double)__x); -#endif } // nan @@ -1626,19 +1236,11 @@ inline _LIBCPP_HIDE_FROM_ABI float rint(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintf) return __builtin_rintf(__x); -#else - return ::rintf(__x); -#endif } inline _LIBCPP_HIDE_FROM_ABI long double rint(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_rintl) return __builtin_rintl(__x); -#else - return ::rintl(__x); -#endif } template @@ -1646,30 +1248,18 @@ typename std::enable_if::value, double>::type rint(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_rint) return __builtin_rint((double)__x); -#else - return ::rint((double)__x); -#endif } // round inline _LIBCPP_HIDE_FROM_ABI float round(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_round) - return __builtin_round(__x); -#else - return ::round(__x); -#endif + return __builtin_roundf(__x); } inline _LIBCPP_HIDE_FROM_ABI long double round(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_roundl) return __builtin_roundl(__x); -#else - return ::roundl(__x); -#endif } template @@ -1677,11 +1267,7 @@ typename std::enable_if::value, double>::type round(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_round) return __builtin_round((double)__x); -#else - return ::round((double)__x); -#endif } // scalbln @@ -1718,19 +1304,11 @@ inline _LIBCPP_HIDE_FROM_ABI float trunc(float __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) - return __builtin_trunc(__x); -#else - return ::trunc(__x); -#endif + return __builtin_truncf(__x); } inline _LIBCPP_HIDE_FROM_ABI long double trunc(long double __x) _NOEXCEPT { -#if __has_builtin(__builtin_truncl) return __builtin_truncl(__x); -#else - return ::truncl(__x); -#endif } template @@ -1738,11 +1316,7 @@ typename std::enable_if::value, double>::type trunc(_A1 __x) _NOEXCEPT { -#if __has_builtin(__builtin_trunc) return __builtin_trunc((double)__x); -#else - return ::trunc((double)__x); -#endif } } // extern "C++"