Index: include/cmath =================================================================== --- include/cmath +++ include/cmath @@ -301,338 +301,10 @@ #include #include -#ifdef _LIBCPP_MSVCRT -#include "support/win32/math_win32.h" -#endif - #if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) #pragma GCC system_header #endif -// signbit - -#ifdef signbit - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT -{ - return signbit(__lcpp_x); -} - -#undef signbit - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -signbit(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // signbit - -// fpclassify - -#ifdef fpclassify - -template -_LIBCPP_ALWAYS_INLINE -int -__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ - return fpclassify(__lcpp_x); -} - -#undef fpclassify - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, int>::type -fpclassify(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // fpclassify - -// isfinite - -#ifdef isfinite - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT -{ - return isfinite(__lcpp_x); -} - -#undef isfinite - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isfinite(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // isfinite - -// isinf - -#ifdef isinf - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT -{ - return isinf(__lcpp_x); -} - -#undef isinf - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isinf(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // isinf - -// isnan - -#ifdef isnan - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT -{ - return isnan(__lcpp_x); -} - -#undef isnan - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnan(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // isnan - -// isnormal - -#ifdef isnormal - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT -{ - return isnormal(__lcpp_x); -} - -#undef isnormal - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if::value, bool>::type -isnormal(_A1 __lcpp_x) _NOEXCEPT -{ - return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); -} - -#endif // isnormal - -// isgreater - -#ifdef isgreater - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isgreater(__lcpp_x, __lcpp_y); -} - -#undef isgreater - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isgreater - -// isgreaterequal - -#ifdef isgreaterequal - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isgreaterequal(__lcpp_x, __lcpp_y); -} - -#undef isgreaterequal - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isgreaterequal - -// isless - -#ifdef isless - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isless(__lcpp_x, __lcpp_y); -} - -#undef isless - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isless - -// islessequal - -#ifdef islessequal - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return islessequal(__lcpp_x, __lcpp_y); -} - -#undef islessequal - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // islessequal - -// islessgreater - -#ifdef islessgreater - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return islessgreater(__lcpp_x, __lcpp_y); -} - -#undef islessgreater - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // islessgreater - -// isunordered - -#ifdef isunordered - -template -_LIBCPP_ALWAYS_INLINE -bool -__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - return isunordered(__lcpp_x, __lcpp_y); -} - -#undef isunordered - -template -inline _LIBCPP_INLINE_VISIBILITY -typename std::enable_if -< - std::is_arithmetic<_A1>::value && - std::is_arithmetic<_A2>::value, - bool ->::type -isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT -{ - typedef typename std::__promote<_A1, _A2>::type type; - return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); -} - -#endif // isunordered - _LIBCPP_BEGIN_NAMESPACE_STD using ::signbit; Index: include/math.h =================================================================== --- /dev/null +++ include/math.h @@ -0,0 +1,350 @@ +// -*- C++ -*- +//===---------------------------- math.h ----------------------------------===// +// +// The LLVM Compiler Infrastructure +// +// This file is dual licensed under the MIT and the University of Illinois Open +// Source Licenses. See LICENSE.TXT for details. +// +//===----------------------------------------------------------------------===// + +#ifndef _LIBCPP_MATH_H +#define _LIBCPP_MATH_H + +#include <__config> +#include_next +#include + +#ifdef _LIBCPP_MSVCRT +#include "support/win32/math_win32.h" +#endif + +#if !defined(_LIBCPP_HAS_NO_PRAGMA_SYSTEM_HEADER) +#pragma GCC system_header +#endif + +// signbit + +#ifdef signbit + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_signbit(_A1 __lcpp_x) _NOEXCEPT +{ + return signbit(__lcpp_x); +} + +#undef signbit + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +signbit(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_signbit((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // signbit + +// fpclassify + +#ifdef fpclassify + +template +_LIBCPP_ALWAYS_INLINE +int +__libcpp_fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ + return fpclassify(__lcpp_x); +} + +#undef fpclassify + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, int>::type +fpclassify(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_fpclassify((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // fpclassify + +// isfinite + +#ifdef isfinite + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isfinite(_A1 __lcpp_x) _NOEXCEPT +{ + return isfinite(__lcpp_x); +} + +#undef isfinite + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isfinite(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_isfinite((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // isfinite + +// isinf + +#ifdef isinf + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isinf(_A1 __lcpp_x) _NOEXCEPT +{ + return isinf(__lcpp_x); +} + +#undef isinf + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isinf(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_isinf((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // isinf + +// isnan + +#ifdef isnan + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isnan(_A1 __lcpp_x) _NOEXCEPT +{ + return isnan(__lcpp_x); +} + +#undef isnan + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnan(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_isnan((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // isnan + +// isnormal + +#ifdef isnormal + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isnormal(_A1 __lcpp_x) _NOEXCEPT +{ + return isnormal(__lcpp_x); +} + +#undef isnormal + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if::value, bool>::type +isnormal(_A1 __lcpp_x) _NOEXCEPT +{ + return __libcpp_isnormal((typename std::__promote<_A1>::type)__lcpp_x); +} + +#endif // isnormal + +// isgreater + +#ifdef isgreater + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return isgreater(__lcpp_x, __lcpp_y); +} + +#undef isgreater + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreater((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isgreater + +// isgreaterequal + +#ifdef isgreaterequal + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return isgreaterequal(__lcpp_x, __lcpp_y); +} + +#undef isgreaterequal + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isgreaterequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isgreaterequal((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isgreaterequal + +// isless + +#ifdef isless + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return isless(__lcpp_x, __lcpp_y); +} + +#undef isless + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isless(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isless((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isless + +// islessequal + +#ifdef islessequal + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return islessequal(__lcpp_x, __lcpp_y); +} + +#undef islessequal + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +islessequal(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessequal((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // islessequal + +// islessgreater + +#ifdef islessgreater + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return islessgreater(__lcpp_x, __lcpp_y); +} + +#undef islessgreater + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +islessgreater(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_islessgreater((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // islessgreater + +// isunordered + +#ifdef isunordered + +template +_LIBCPP_ALWAYS_INLINE +bool +__libcpp_isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + return isunordered(__lcpp_x, __lcpp_y); +} + +#undef isunordered + +template +inline _LIBCPP_INLINE_VISIBILITY +typename std::enable_if +< + std::is_arithmetic<_A1>::value && + std::is_arithmetic<_A2>::value, + bool +>::type +isunordered(_A1 __lcpp_x, _A2 __lcpp_y) _NOEXCEPT +{ + typedef typename std::__promote<_A1, _A2>::type type; + return __libcpp_isunordered((type)__lcpp_x, (type)__lcpp_y); +} + +#endif // isunordered + +#endif // _LIBCPP_MATH_H