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