diff options
Diffstat (limited to 'lib/libcxx/include/math.h')
-rw-r--r-- | lib/libcxx/include/math.h | 66 |
1 files changed, 54 insertions, 12 deletions
diff --git a/lib/libcxx/include/math.h b/lib/libcxx/include/math.h index 8c30ba85d22..3cc72aa2791 100644 --- a/lib/libcxx/include/math.h +++ b/lib/libcxx/include/math.h @@ -314,7 +314,7 @@ extern "C++" { #ifdef signbit template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT { @@ -376,7 +376,7 @@ signbit(_A1) _NOEXCEPT #ifdef fpclassify template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY int __libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT { @@ -422,7 +422,7 @@ fpclassify(_A1 __lcpp_x) _NOEXCEPT #ifdef isfinite template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT { @@ -456,7 +456,7 @@ isfinite(_A1) _NOEXCEPT #ifdef isinf template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT { @@ -483,6 +483,20 @@ typename std::enable_if< isinf(_A1) _NOEXCEPT { return false; } +#ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_INLINE_VISIBILITY +bool +isinf(float __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD +bool +isinf(double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY +bool +isinf(long double __lcpp_x) _NOEXCEPT { return __libcpp_isinf(__lcpp_x); } +#endif + #endif // isinf // isnan @@ -490,7 +504,7 @@ isinf(_A1) _NOEXCEPT #ifdef isnan template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT { @@ -513,6 +527,20 @@ typename std::enable_if<std::is_integral<_A1>::value, bool>::type isnan(_A1) _NOEXCEPT { return false; } +#ifdef _LIBCPP_PREFERRED_OVERLOAD +inline _LIBCPP_INLINE_VISIBILITY +bool +isnan(float __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY _LIBCPP_PREFERRED_OVERLOAD +bool +isnan(double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } + +inline _LIBCPP_INLINE_VISIBILITY +bool +isnan(long double __lcpp_x) _NOEXCEPT { return __libcpp_isnan(__lcpp_x); } +#endif + #endif // isnan // isnormal @@ -520,7 +548,7 @@ isnan(_A1) _NOEXCEPT #ifdef isnormal template <class _A1> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT { @@ -550,7 +578,7 @@ isnormal(_A1 __lcpp_x) _NOEXCEPT #ifdef isgreater template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -580,7 +608,7 @@ isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT #ifdef isgreaterequal template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -610,7 +638,7 @@ isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT #ifdef isless template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -640,7 +668,7 @@ isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT #ifdef islessequal template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -670,7 +698,7 @@ islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT #ifdef islessgreater template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -700,7 +728,7 @@ islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT #ifdef isunordered template <class _A1, class _A2> -_LIBCPP_ALWAYS_INLINE +_LIBCPP_INLINE_VISIBILITY bool __libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT { @@ -1486,4 +1514,18 @@ trunc(_A1 __lcpp_x) _NOEXCEPT {return ::trunc((double)__lcpp_x);} #endif // __cplusplus +#else // _LIBCPP_MATH_H + +// This include lives outside the header guard in order to support an MSVC +// extension which allows users to do: +// +// #define _USE_MATH_DEFINES +// #include <math.h> +// +// and receive the definitions of mathematical constants, even if <math.h> +// has previously been included. +#if defined(_LIBCPP_MSVCRT) && defined(_USE_MATH_DEFINES) +#include_next <math.h> +#endif + #endif // _LIBCPP_MATH_H |