[gcc r16-3417] libstdc++: Use _M_reverse to reverse partial_ordering using operator<=>
Tomasz Kaminski
tkaminsk@gcc.gnu.org
Wed Aug 27 15:33:07 GMT 2025
https://gcc.gnu.org/g:b3038e1ace2a4e521763ac872c8265b7c7142252
commit r16-3417-gb3038e1ace2a4e521763ac872c8265b7c7142252
Author: Tomasz Kamiński <tkaminsk@redhat.com>
Date: Wed Aug 27 16:43:16 2025 +0200
libstdc++: Use _M_reverse to reverse partial_ordering using operator<=>
The patch r16-3414-gfcb3009a32dc33 changed the representation of unordered to
optimize reversing of order, but it did not update implementation of reversing
operator<=>(0, partial_order).
libstdc++-v3/ChangeLog:
* libsupc++/compare
(operator<=>(__cmp_cat::__unspec, partial_ordering)):
Implement using _M_reverse.
Reviewed-by: Jonathan Wakely <jwakely@redhat.com>
Signed-off-by: Tomasz Kamiński <tkaminsk@redhat.com>
Diff:
---
libstdc++-v3/libsupc++/compare | 7 +------
1 file changed, 1 insertion(+), 6 deletions(-)
diff --git a/libstdc++-v3/libsupc++/compare b/libstdc++-v3/libsupc++/compare
index 2624fa9144fb..ef0f03769646 100644
--- a/libstdc++-v3/libsupc++/compare
+++ b/libstdc++-v3/libsupc++/compare
@@ -155,12 +155,7 @@ namespace std _GLIBCXX_VISIBILITY(default)
[[nodiscard]]
friend constexpr partial_ordering
operator<=>(__cmp_cat::__unspec, partial_ordering __v) noexcept
- {
- if (__v._M_value & 1)
- return partial_ordering(__cmp_cat::_Ord(-__v._M_value));
- else
- return __v;
- }
+ { return partial_ordering(__cmp_cat::_Ncmp(__v._M_reverse())); }
};
// valid values' definitions
More information about the Libstdc++-cvs
mailing list