Release Cosmopolitan v3.6.0

This release is an atomic upgrade to GCC 14.1.0 with C23 and C++23
This commit is contained in:
Justine Tunney 2024-07-23 03:16:17 -07:00
parent 62ace3623a
commit 5660ec4741
No known key found for this signature in database
GPG key ID: BE714B4575D6E328
1585 changed files with 117353 additions and 271644 deletions

View file

@ -204,6 +204,14 @@ floating_point fmin (arithmetic x, arithmetic y);
float fminf(float x, float y);
long double fminl(long double x, long double y);
double hermite(unsigned n, double x); // C++17
float hermite(unsigned n, float x); // C++17
long double hermite(unsigned n, long double x); // C++17
float hermitef(unsigned n, float x); // C++17
long double hermitel(unsigned n, long double x); // C++17
template <class Integer>
double hermite(unsigned n, Integer x); // C++17
floating_point hypot (arithmetic x, arithmetic y);
float hypotf(float x, float y);
long double hypotl(long double x, long double y);
@ -304,7 +312,6 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
*/
#include <__assert> // all public C++ headers provide the assertion handler
#include <__config>
#include <__type_traits/enable_if.h>
#include <__type_traits/is_arithmetic.h>
@ -313,8 +320,10 @@ constexpr long double lerp(long double a, long double b, long double t) noexcept
#include <__type_traits/is_same.h>
#include <__type_traits/promote.h>
#include <__type_traits/remove_cv.h>
#include <limits>
#include <version>
#include <__math/special_functions.h>
#include <math.h>
#ifndef _LIBCPP_MATH_H
@ -545,284 +554,107 @@ using ::tgammal _LIBCPP_USING_IF_EXISTS;
using ::truncl _LIBCPP_USING_IF_EXISTS;
#if _LIBCPP_STD_VER >= 17
inline _LIBCPP_INLINE_VISIBILITY float hypot( float __x, float __y, float __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
inline _LIBCPP_INLINE_VISIBILITY double hypot( double __x, double __y, double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
inline _LIBCPP_INLINE_VISIBILITY long double hypot( long double __x, long double __y, long double __z ) { return sqrt(__x*__x + __y*__y + __z*__z); }
inline _LIBCPP_HIDE_FROM_ABI float hypot(float __x, float __y, float __z) {
return sqrt(__x * __x + __y * __y + __z * __z);
}
inline _LIBCPP_HIDE_FROM_ABI double hypot(double __x, double __y, double __z) {
return sqrt(__x * __x + __y * __y + __z * __z);
}
inline _LIBCPP_HIDE_FROM_ABI long double hypot(long double __x, long double __y, long double __z) {
return sqrt(__x * __x + __y * __y + __z * __z);
}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_INLINE_VISIBILITY
typename enable_if_t
<
is_arithmetic<_A1>::value &&
is_arithmetic<_A2>::value &&
is_arithmetic<_A3>::value,
__promote<_A1, _A2, _A3>
>::type
hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT
{
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
static_assert((!(is_same<_A1, __result_type>::value &&
is_same<_A2, __result_type>::value &&
is_same<_A3, __result_type>::value)), "");
return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
inline _LIBCPP_HIDE_FROM_ABI
typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
__promote<_A1, _A2, _A3> >::type
hypot(_A1 __lcpp_x, _A2 __lcpp_y, _A3 __lcpp_z) _NOEXCEPT {
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
static_assert(
!(is_same<_A1, __result_type>::value && is_same<_A2, __result_type>::value && is_same<_A3, __result_type>::value),
"");
return std::hypot((__result_type)__lcpp_x, (__result_type)__lcpp_y, (__result_type)__lcpp_z);
}
#endif
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
{
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isnan)
return __builtin_isnan(__lcpp_x);
return __builtin_isnan(__lcpp_x);
#else
return isnan(__lcpp_x);
return isnan(__lcpp_x);
#endif
}
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT
{
return std::isnan(__lcpp_x);
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isnan(_A1 __lcpp_x) _NOEXCEPT {
return std::isnan(__lcpp_x);
}
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
{
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isinf)
return __builtin_isinf(__lcpp_x);
return __builtin_isinf(__lcpp_x);
#else
return isinf(__lcpp_x);
return isinf(__lcpp_x);
#endif
}
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT
{
return std::isinf(__lcpp_x);
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isinf(_A1 __lcpp_x) _NOEXCEPT {
return std::isinf(__lcpp_x);
}
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<is_floating_point<_A1>::value, bool>::type
__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
{
template <class _A1, __enable_if_t<is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
#if __has_builtin(__builtin_isfinite)
return __builtin_isfinite(__lcpp_x);
return __builtin_isfinite(__lcpp_x);
#else
return isfinite(__lcpp_x);
return isfinite(__lcpp_x);
#endif
}
template <class _A1>
_LIBCPP_INLINE_VISIBILITY
_LIBCPP_CONSTEXPR typename enable_if<!is_floating_point<_A1>::value, bool>::type
__constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT
{
return __builtin_isfinite(__lcpp_x);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI float __constexpr_copysign(float __x, float __y) _NOEXCEPT {
return __builtin_copysignf(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI double __constexpr_copysign(double __x, double __y) _NOEXCEPT {
return __builtin_copysign(__x, __y);
}
_LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI long double
__constexpr_copysign(long double __x, long double __y) _NOEXCEPT {
return __builtin_copysignl(__x, __y);
}
template <class _A1, class _A2>
_LIBCPP_CONSTEXPR 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
__constexpr_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)), "");
return __builtin_copysign((__result_type)__x, (__result_type)__y);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float __constexpr_fabs(float __x) _NOEXCEPT {
return __builtin_fabsf(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(double __x) _NOEXCEPT {
return __builtin_fabs(__x);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double __constexpr_fabs(long double __x) _NOEXCEPT {
return __builtin_fabsl(__x);
}
template <class _Tp, __enable_if_t<is_integral<_Tp>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs(_Tp __x) _NOEXCEPT {
return __builtin_fabs(static_cast<double>(__x));
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax(float __x, float __y) _NOEXCEPT {
#if !__has_constexpr_builtin(__builtin_fmaxf)
if (__libcpp_is_constant_evaluated()) {
if (std::__constexpr_isnan(__x))
return __y;
if (std::__constexpr_isnan(__y))
return __x;
return __x < __y ? __y : __x;
}
#endif
return __builtin_fmaxf(__x, __y);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 double __constexpr_fmax(double __x, double __y) _NOEXCEPT {
#if !__has_constexpr_builtin(__builtin_fmax)
if (__libcpp_is_constant_evaluated()) {
if (std::__constexpr_isnan(__x))
return __y;
if (std::__constexpr_isnan(__y))
return __x;
return __x < __y ? __y : __x;
}
#endif
return __builtin_fmax(__x, __y);
}
inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 long double
__constexpr_fmax(long double __x, long double __y) _NOEXCEPT {
#if !__has_constexpr_builtin(__builtin_fmaxl)
if (__libcpp_is_constant_evaluated()) {
if (std::__constexpr_isnan(__x))
return __y;
if (std::__constexpr_isnan(__y))
return __x;
return __x < __y ? __y : __x;
}
#endif
return __builtin_fmaxl(__x, __y);
}
template <class _Tp, class _Up, __enable_if_t<is_arithmetic<_Tp>::value && is_arithmetic<_Up>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __promote<_Tp, _Up>::type
__constexpr_fmax(_Tp __x, _Up __y) _NOEXCEPT {
using __result_type = typename __promote<_Tp, _Up>::type;
return std::__constexpr_fmax(static_cast<__result_type>(__x), static_cast<__result_type>(__y));
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb(_Tp __x) {
#if !__has_constexpr_builtin(__builtin_logb)
if (__libcpp_is_constant_evaluated()) {
if (__x == _Tp(0)) {
// raise FE_DIVBYZERO
return -numeric_limits<_Tp>::infinity();
}
if (std::__constexpr_isinf(__x))
return numeric_limits<_Tp>::infinity();
if (std::__constexpr_isnan(__x))
return numeric_limits<_Tp>::quiet_NaN();
__x = std::__constexpr_fabs(__x);
unsigned long long __exp = 0;
while (__x >= numeric_limits<_Tp>::radix) {
__x /= numeric_limits<_Tp>::radix;
__exp += 1;
}
return _Tp(__exp);
}
#endif // !__has_constexpr_builtin(__builtin_logb)
return __builtin_logb(__x);
}
template <class _Tp>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn(_Tp __x, int __exp) {
#if !__has_constexpr_builtin(__builtin_scalbln)
if (__libcpp_is_constant_evaluated()) {
if (__x == _Tp(0))
return __x;
if (std::__constexpr_isinf(__x))
return __x;
if (__exp == _Tp(0))
return __x;
if (std::__constexpr_isnan(__x))
return numeric_limits<_Tp>::quiet_NaN();
_Tp __mult(1);
if (__exp > 0) {
__mult = numeric_limits<_Tp>::radix;
--__exp;
} else {
++__exp;
__exp = -__exp;
__mult /= numeric_limits<_Tp>::radix;
}
while (__exp > 0) {
if (!(__exp & 1)) {
__mult *= __mult;
__exp >>= 1;
} else {
__x *= __mult;
--__exp;
}
}
return __x;
}
#endif // !__has_constexpr_builtin(__builtin_scalbln)
return __builtin_scalbn(__x, __exp);
template <class _A1, __enable_if_t<!is_floating_point<_A1>::value, int> = 0>
_LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x) _NOEXCEPT {
return __builtin_isfinite(__lcpp_x);
}
#if _LIBCPP_STD_VER >= 20
template <typename _Fp>
_LIBCPP_HIDE_FROM_ABI constexpr
_Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
return __t * __b + (1 - __t) * __a;
_LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp(_Fp __a, _Fp __b, _Fp __t) noexcept {
if ((__a <= 0 && __b >= 0) || (__a >= 0 && __b <= 0))
return __t * __b + (1 - __t) * __a;
if (__t == 1) return __b;
const _Fp __x = __a + __t * (__b - __a);
if ((__t > 1) == (__b > __a))
return __b < __x ? __x : __b;
else
return __x < __b ? __x : __b;
if (__t == 1)
return __b;
const _Fp __x = __a + __t * (__b - __a);
if ((__t > 1) == (__b > __a))
return __b < __x ? __x : __b;
else
return __x < __b ? __x : __b;
}
_LIBCPP_HIDE_FROM_ABI constexpr float
lerp(float __a, float __b, float __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
_LIBCPP_HIDE_FROM_ABI inline constexpr float lerp(float __a, float __b, float __t) _NOEXCEPT {
return __lerp(__a, __b, __t);
}
_LIBCPP_HIDE_FROM_ABI constexpr double
lerp(double __a, double __b, double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
_LIBCPP_HIDE_FROM_ABI inline constexpr double lerp(double __a, double __b, double __t) _NOEXCEPT {
return __lerp(__a, __b, __t);
}
_LIBCPP_HIDE_FROM_ABI constexpr long double
lerp(long double __a, long double __b, long double __t) _NOEXCEPT { return __lerp(__a, __b, __t); }
_LIBCPP_HIDE_FROM_ABI inline constexpr long double lerp(long double __a, long double __b, long double __t) _NOEXCEPT {
return __lerp(__a, __b, __t);
}
template <class _A1, class _A2, class _A3>
inline _LIBCPP_HIDE_FROM_ABI
constexpr typename enable_if_t
<
is_arithmetic<_A1>::value &&
is_arithmetic<_A2>::value &&
is_arithmetic<_A3>::value,
__promote<_A1, _A2, _A3>
>::type
lerp(_A1 __a, _A2 __b, _A3 __t) noexcept
{
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
static_assert(!(_IsSame<_A1, __result_type>::value &&
_IsSame<_A2, __result_type>::value &&
_IsSame<_A3, __result_type>::value));
return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
inline _LIBCPP_HIDE_FROM_ABI constexpr
typename enable_if_t< is_arithmetic<_A1>::value && is_arithmetic<_A2>::value && is_arithmetic<_A3>::value,
__promote<_A1, _A2, _A3> >::type
lerp(_A1 __a, _A2 __b, _A3 __t) noexcept {
typedef typename __promote<_A1, _A2, _A3>::type __result_type;
static_assert(!(
_IsSame<_A1, __result_type>::value && _IsSame<_A2, __result_type>::value && _IsSame<_A3, __result_type>::value));
return std::__lerp((__result_type)__a, (__result_type)__b, (__result_type)__t);
}
#endif // _LIBCPP_STD_VER >= 20