@@ -610,161 +610,6 @@ _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR bool __constexpr_isfinite(_A1 __lcpp_x)
610
610
return __builtin_isfinite (__lcpp_x);
611
611
}
612
612
613
- _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI float __constexpr_copysign (float __x, float __y) _NOEXCEPT {
614
- return __builtin_copysignf (__x, __y);
615
- }
616
-
617
- _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI double __constexpr_copysign (double __x, double __y) _NOEXCEPT {
618
- return __builtin_copysign (__x, __y);
619
- }
620
-
621
- _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI long double
622
- __constexpr_copysign (long double __x, long double __y) _NOEXCEPT {
623
- return __builtin_copysignl (__x, __y);
624
- }
625
-
626
- template <class _A1 ,
627
- class _A2 ,
628
- __enable_if_t <std::is_arithmetic<_A1>::value && std::is_arithmetic<_A2>::value, int > = 0 >
629
- _LIBCPP_CONSTEXPR inline _LIBCPP_HIDE_FROM_ABI typename __promote<_A1, _A2>::type
630
- __constexpr_copysign (_A1 __x, _A2 __y) _NOEXCEPT {
631
- typedef typename std::__promote<_A1, _A2>::type __result_type;
632
- static_assert (!(std::_IsSame<_A1, __result_type>::value && std::_IsSame<_A2, __result_type>::value), " " );
633
- return __builtin_copysign ((__result_type)__x, (__result_type)__y);
634
- }
635
-
636
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR float __constexpr_fabs (float __x) _NOEXCEPT {
637
- return __builtin_fabsf (__x);
638
- }
639
-
640
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs (double __x) _NOEXCEPT {
641
- return __builtin_fabs (__x);
642
- }
643
-
644
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR long double __constexpr_fabs (long double __x) _NOEXCEPT {
645
- return __builtin_fabsl (__x);
646
- }
647
-
648
- template <class _Tp , __enable_if_t <is_integral<_Tp>::value, int > = 0 >
649
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR double __constexpr_fabs (_Tp __x) _NOEXCEPT {
650
- return __builtin_fabs (static_cast <double >(__x));
651
- }
652
-
653
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 float __constexpr_fmax (float __x, float __y) _NOEXCEPT {
654
- #if !__has_constexpr_builtin(__builtin_fmaxf)
655
- if (__libcpp_is_constant_evaluated ()) {
656
- if (std::__constexpr_isnan (__x))
657
- return __y;
658
- if (std::__constexpr_isnan (__y))
659
- return __x;
660
- return __x < __y ? __y : __x;
661
- }
662
- #endif
663
- return __builtin_fmaxf (__x, __y);
664
- }
665
-
666
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 double __constexpr_fmax (double __x, double __y) _NOEXCEPT {
667
- #if !__has_constexpr_builtin(__builtin_fmax)
668
- if (__libcpp_is_constant_evaluated ()) {
669
- if (std::__constexpr_isnan (__x))
670
- return __y;
671
- if (std::__constexpr_isnan (__y))
672
- return __x;
673
- return __x < __y ? __y : __x;
674
- }
675
- #endif
676
- return __builtin_fmax (__x, __y);
677
- }
678
-
679
- inline _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 long double
680
- __constexpr_fmax (long double __x, long double __y) _NOEXCEPT {
681
- #if !__has_constexpr_builtin(__builtin_fmaxl)
682
- if (__libcpp_is_constant_evaluated ()) {
683
- if (std::__constexpr_isnan (__x))
684
- return __y;
685
- if (std::__constexpr_isnan (__y))
686
- return __x;
687
- return __x < __y ? __y : __x;
688
- }
689
- #endif
690
- return __builtin_fmaxl (__x, __y);
691
- }
692
-
693
- template <class _Tp , class _Up , __enable_if_t <is_arithmetic<_Tp>::value && is_arithmetic<_Up>::value, int > = 0 >
694
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 typename __promote<_Tp, _Up>::type
695
- __constexpr_fmax (_Tp __x, _Up __y) _NOEXCEPT {
696
- using __result_type = typename __promote<_Tp, _Up>::type;
697
- return std::__constexpr_fmax (static_cast <__result_type>(__x), static_cast <__result_type>(__y));
698
- }
699
-
700
- template <class _Tp >
701
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX14 _Tp __constexpr_logb (_Tp __x) {
702
- #if !__has_constexpr_builtin(__builtin_logb)
703
- if (__libcpp_is_constant_evaluated ()) {
704
- if (__x == _Tp (0 )) {
705
- // raise FE_DIVBYZERO
706
- return -numeric_limits<_Tp>::infinity ();
707
- }
708
-
709
- if (std::__constexpr_isinf (__x))
710
- return numeric_limits<_Tp>::infinity ();
711
-
712
- if (std::__constexpr_isnan (__x))
713
- return numeric_limits<_Tp>::quiet_NaN ();
714
-
715
- __x = std::__constexpr_fabs (__x);
716
- unsigned long long __exp = 0 ;
717
- while (__x >= numeric_limits<_Tp>::radix) {
718
- __x /= numeric_limits<_Tp>::radix;
719
- __exp += 1 ;
720
- }
721
- return _Tp (__exp);
722
- }
723
- #endif // !__has_constexpr_builtin(__builtin_logb)
724
- return __builtin_logb (__x);
725
- }
726
-
727
- template <class _Tp >
728
- _LIBCPP_HIDE_FROM_ABI _LIBCPP_CONSTEXPR_SINCE_CXX20 _Tp __constexpr_scalbn (_Tp __x, int __exp) {
729
- #if !__has_constexpr_builtin(__builtin_scalbln)
730
- if (__libcpp_is_constant_evaluated ()) {
731
- if (__x == _Tp (0 ))
732
- return __x;
733
-
734
- if (std::__constexpr_isinf (__x))
735
- return __x;
736
-
737
- if (__exp == _Tp (0 ))
738
- return __x;
739
-
740
- if (std::__constexpr_isnan (__x))
741
- return numeric_limits<_Tp>::quiet_NaN ();
742
-
743
- _Tp __mult (1 );
744
- if (__exp > 0 ) {
745
- __mult = numeric_limits<_Tp>::radix;
746
- --__exp;
747
- } else {
748
- ++__exp;
749
- __exp = -__exp;
750
- __mult /= numeric_limits<_Tp>::radix;
751
- }
752
-
753
- while (__exp > 0 ) {
754
- if (!(__exp & 1 )) {
755
- __mult *= __mult;
756
- __exp >>= 1 ;
757
- } else {
758
- __x *= __mult;
759
- --__exp;
760
- }
761
- }
762
- return __x;
763
- }
764
- #endif // !__has_constexpr_builtin(__builtin_scalbln)
765
- return __builtin_scalbn (__x, __exp);
766
- }
767
-
768
613
#if _LIBCPP_STD_VER >= 20
769
614
template <typename _Fp>
770
615
_LIBCPP_HIDE_FROM_ABI constexpr _Fp __lerp (_Fp __a, _Fp __b, _Fp __t ) noexcept {
0 commit comments