@@ -43,12 +43,6 @@ _STL_DISABLE_CLANG_WARNINGS
43
43
#endif // _USE_STD_VECTOR_ALGORITHMS
44
44
#endif // ^^^ no support for vector algorithms ^^^
45
45
46
- #ifdef __CUDACC__
47
- #define _CONSTEXPR_BIT_CAST inline
48
- #else // ^^^ workaround ^^^ / vvv no workaround vvv
49
- #define _CONSTEXPR_BIT_CAST constexpr
50
- #endif // ^^^ no workaround ^^^
51
-
52
46
#if _USE_STD_VECTOR_ALGORITHMS
53
47
_EXTERN_C
54
48
// The "noalias" attribute tells the compiler optimizer that pointers going into these hand-vectorized algorithms
@@ -152,14 +146,8 @@ template <class _To, class _From,
152
146
enable_if_t<conjunction_v<bool_constant<sizeof(_To) == sizeof(_From)>, is_trivially_copyable<_To>,
153
147
is_trivially_copyable<_From>>,
154
148
int> = 0>
155
- _NODISCARD _CONSTEXPR_BIT_CAST _To _Bit_cast(const _From& _Val) noexcept {
156
- #ifdef __CUDACC__
157
- _To _To_obj; // assumes default-init
158
- _CSTD memcpy(_STD addressof(_To_obj), _STD addressof(_Val), sizeof(_To));
159
- return _To_obj;
160
- #else // ^^^ workaround ^^^ / vvv no workaround vvv
149
+ _NODISCARD constexpr _To _Bit_cast(const _From& _Val) noexcept {
161
150
return __builtin_bit_cast(_To, _Val);
162
- #endif // ^^^ no workaround ^^^
163
151
}
164
152
165
153
template <class _Ty>
@@ -5114,7 +5102,7 @@ _NODISCARD _CONSTEXPR20 _InIt _Find_unchecked(_InIt _First, const _InIt _Last, c
5114
5102
#else // ^^^ _USE_STD_VECTOR_ALGORITHMS ^^^ / vvv not _USE_STD_VECTOR_ALGORITHMS vvv
5115
5103
if constexpr (sizeof(_Iter_value_t<_InIt>) == 1) {
5116
5104
const auto _First_ptr = _To_address(_First);
5117
- const auto _Result = static_cast<remove_reference_t<_Iter_ref_t<_InIt>>*>(
5105
+ const auto _Result = static_cast<remove_reference_t<_Iter_ref_t<_InIt>>*>(
5118
5106
_CSTD memchr(_First_ptr, static_cast<unsigned char>(_Val), static_cast<size_t>(_Last - _First)));
5119
5107
if constexpr (is_pointer_v<_InIt>) {
5120
5108
return _Result ? _Result : _Last;
@@ -6100,28 +6088,28 @@ struct _CXX17_DEPRECATE_ITERATOR_BASE_CLASS iterator { // base type for iterator
6100
6088
};
6101
6089
6102
6090
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6103
- _NODISCARD _CONSTEXPR_BIT_CAST auto _Float_abs_bits(const _Ty& _Xx) {
6091
+ _NODISCARD constexpr auto _Float_abs_bits(const _Ty& _Xx) {
6104
6092
using _Traits = _Floating_type_traits<_Ty>;
6105
6093
using _Uint_type = typename _Traits::_Uint_type;
6106
6094
const auto _Bits = _Bit_cast<_Uint_type>(_Xx);
6107
6095
return _Bits & ~_Traits::_Shifted_sign_mask;
6108
6096
}
6109
6097
6110
6098
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6111
- _NODISCARD _CONSTEXPR_BIT_CAST _Ty _Float_abs(const _Ty _Xx) { // constexpr floating-point abs()
6099
+ _NODISCARD constexpr _Ty _Float_abs(const _Ty _Xx) { // constexpr floating-point abs()
6112
6100
return _Bit_cast<_Ty>(_Float_abs_bits(_Xx));
6113
6101
}
6114
6102
6115
6103
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6116
- _NODISCARD _CONSTEXPR_BIT_CAST _Ty _Float_copysign(const _Ty _Magnitude, const _Ty _Sign) { // constexpr copysign()
6104
+ _NODISCARD constexpr _Ty _Float_copysign(const _Ty _Magnitude, const _Ty _Sign) { // constexpr copysign()
6117
6105
using _Traits = _Floating_type_traits<_Ty>;
6118
6106
using _Uint_type = typename _Traits::_Uint_type;
6119
6107
const auto _Signbit = _Bit_cast<_Uint_type>(_Sign) & _Traits::_Shifted_sign_mask;
6120
6108
return _Bit_cast<_Ty>(_Float_abs_bits(_Magnitude) | _Signbit);
6121
6109
}
6122
6110
6123
6111
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6124
- _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_nan(const _Ty _Xx) { // constexpr isnan()
6112
+ _NODISCARD constexpr bool _Is_nan(const _Ty _Xx) { // constexpr isnan()
6125
6113
using _Traits = _Floating_type_traits<_Ty>;
6126
6114
return _Float_abs_bits(_Xx) > _Traits::_Shifted_exponent_mask;
6127
6115
}
@@ -6131,20 +6119,20 @@ _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_nan(const _Ty _Xx) { // constexpr isnan(
6131
6119
// When the value is a 32-bit or 64-bit signaling NaN, the conversion to/from 80-bit raises FE_INVALID
6132
6120
// and turns it into a quiet NaN. This behavior is undesirable if we want to test for signaling NaNs.
6133
6121
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6134
- _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_signaling_nan(const _Ty& _Xx) { // returns true if input is a signaling NaN
6122
+ _NODISCARD constexpr bool _Is_signaling_nan(const _Ty& _Xx) { // returns true if input is a signaling NaN
6135
6123
using _Traits = _Floating_type_traits<_Ty>;
6136
6124
const auto _Abs_bits = _Float_abs_bits(_Xx);
6137
6125
return _Abs_bits > _Traits::_Shifted_exponent_mask && ((_Abs_bits & _Traits::_Special_nan_mantissa_mask) == 0);
6138
6126
}
6139
6127
6140
6128
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6141
- _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_inf(const _Ty _Xx) { // constexpr isinf()
6129
+ _NODISCARD constexpr bool _Is_inf(const _Ty _Xx) { // constexpr isinf()
6142
6130
using _Traits = _Floating_type_traits<_Ty>;
6143
6131
return _Float_abs_bits(_Xx) == _Traits::_Shifted_exponent_mask;
6144
6132
}
6145
6133
6146
6134
template <class _Ty, enable_if_t<is_floating_point_v<_Ty>, int> = 0>
6147
- _NODISCARD _CONSTEXPR_BIT_CAST bool _Is_finite(const _Ty _Xx) { // constexpr isfinite()
6135
+ _NODISCARD constexpr bool _Is_finite(const _Ty _Xx) { // constexpr isfinite()
6148
6136
using _Traits = _Floating_type_traits<_Ty>;
6149
6137
return _Float_abs_bits(_Xx) < _Traits::_Shifted_exponent_mask;
6150
6138
}
0 commit comments