File tree Expand file tree Collapse file tree 3 files changed +4
-1
lines changed
Expand file tree Collapse file tree 3 files changed +4
-1
lines changed Original file line number Diff line number Diff line change @@ -130,7 +130,8 @@ std::strong_ordering iobuf::operator<=>(const iobuf& o) const {
130130 constexpr static size_t max_byte_for_byte_cmp = 4 ;
131131 const auto n = std::min ({lhs.size (), rhs.size (), max_byte_for_byte_cmp});
132132 for (size_t i = 0 ; i < n; ++i) {
133- const auto cmp = lhs[i] <=> rhs[i];
133+ const auto cmp = static_cast <unsigned char >(lhs[i])
134+ <=> static_cast <unsigned char >(rhs[i]);
134135 if (cmp != std::strong_ordering::equal) {
135136 return cmp;
136137 }
Original file line number Diff line number Diff line change @@ -252,6 +252,7 @@ class iobuf {
252252 bool operator ==(const iobuf&) const ;
253253 bool operator <(const iobuf&) const ;
254254 bool operator !=(const iobuf&) const ;
255+ // / Does an unsigned byte-wise comparison between this iobuf and the other.
255256 std::strong_ordering operator <=>(const iobuf&) const ;
256257
257258 bool operator ==(std::string_view) const ;
Original file line number Diff line number Diff line change @@ -51,6 +51,7 @@ SEASTAR_THREAD_TEST_CASE(test_lt) {
5151 BOOST_CHECK_LT (iobuf::from (" " ), iobuf::from (" cat" ));
5252 BOOST_CHECK_LT (iobuf::from (" cat" ), iobuf::from (" dog" ));
5353 BOOST_CHECK_LT (iobuf::from (" cat" ), iobuf::from (" catastrophe" ));
54+ BOOST_CHECK_LT (iobuf::from (" \x01 " ), iobuf::from (" \xFF " ));
5455 BOOST_CHECK_EQUAL (false , iobuf::from (" cat" ) < iobuf::from (" cat" ));
5556 BOOST_CHECK_EQUAL (false , iobuf{} < iobuf{});
5657 BOOST_CHECK (std::strong_ordering::equal == (iobuf{} <=> iobuf{}));
You can’t perform that action at this time.
0 commit comments