|
| 1 | +--- a/usr/include/c++/12/bits/stl_algobase.h |
| 2 | ++++ b/usr/include/c++/12/bits/stl_algobase.h |
| 3 | +@@ -1778,11 +1778,14 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO |
| 4 | + } |
| 5 | + |
| 6 | + #if __cpp_lib_three_way_comparison |
| 7 | +- // Iter points to a contiguous range of unsigned narrow character type |
| 8 | +- // or std::byte, suitable for comparison by memcmp. |
| 9 | +- template<typename _Iter> |
| 10 | +- concept __is_byte_iter = contiguous_iterator<_Iter> |
| 11 | +- && __is_memcmp_ordered<iter_value_t<_Iter>>::__value; |
| 12 | ++ // Both iterators refer to contiguous ranges of unsigned narrow characters, |
| 13 | ++ // or std::byte, or big-endian unsigned integers, suitable for comparison |
| 14 | ++ // using memcmp. |
| 15 | ++ template<typename _Iter1, typename _Iter2> |
| 16 | ++ concept __memcmp_ordered_with |
| 17 | ++ = (__is_memcmp_ordered_with<iter_value_t<_Iter1>, |
| 18 | ++ iter_value_t<_Iter2>>::__value) |
| 19 | ++ && contiguous_iterator<_Iter1> && contiguous_iterator<_Iter2>; |
| 20 | + |
| 21 | + // Return a struct with two members, initialized to the smaller of x and y |
| 22 | + // (or x if they compare equal) and the result of the comparison x <=> y. |
| 23 | +@@ -1832,20 +1832,20 @@ _GLIBCXX_BEGIN_NAMESPACE_ALGO |
| 24 | + if (!std::__is_constant_evaluated()) |
| 25 | + if constexpr (same_as<_Comp, __detail::_Synth3way> |
| 26 | + || same_as<_Comp, compare_three_way>) |
| 27 | +- if constexpr (__is_byte_iter<_InputIter1>) |
| 28 | +- if constexpr (__is_byte_iter<_InputIter2>) |
| 29 | +- { |
| 30 | +- const auto [__len, __lencmp] = _GLIBCXX_STD_A:: |
| 31 | +- __min_cmp(__last1 - __first1, __last2 - __first2); |
| 32 | +- if (__len) |
| 33 | +- { |
| 34 | +- const auto __c |
| 35 | +- = __builtin_memcmp(&*__first1, &*__first2, __len) <=> 0; |
| 36 | +- if (__c != 0) |
| 37 | +- return __c; |
| 38 | +- } |
| 39 | +- return __lencmp; |
| 40 | +- } |
| 41 | ++ if constexpr (__memcmp_ordered_with<_InputIter1, _InputIter2>) |
| 42 | ++ { |
| 43 | ++ const auto [__len, __lencmp] = _GLIBCXX_STD_A:: |
| 44 | ++ __min_cmp(__last1 - __first1, __last2 - __first2); |
| 45 | ++ if (__len) |
| 46 | ++ { |
| 47 | ++ const auto __blen = __len * sizeof(*__first1); |
| 48 | ++ const auto __c |
| 49 | ++ = __builtin_memcmp(&*__first1, &*__first2, __blen) <=> 0; |
| 50 | ++ if (__c != 0) |
| 51 | ++ return __c; |
| 52 | ++ } |
| 53 | ++ return __lencmp; |
| 54 | ++ } |
| 55 | + |
| 56 | + while (__first1 != __last1) |
| 57 | + { |
0 commit comments