types: fix uuid_type_impl::less

timeuuid_type_impl::compare_bytes is a "trichotomic" comparator (-1,
0, 1) while less() is a "less" comparator (false, true). The code
incorrectly returns c1 instead of c1 < 0 which breaks the ordering.

Fixes #1196.
Message-Id: <1473956716-5209-1-git-send-email-tgrabiec@scylladb.com>
This commit is contained in:
Tomasz Grabiec
2016-09-15 18:25:14 +02:00
committed by Paweł Dziepak
parent bc3cbb7009
commit 804fe50b7f

View File

@@ -773,11 +773,9 @@ struct uuid_type_impl : concrete_type<utils::UUID> {
}
if (v1 == 1) {
auto c1 = timeuuid_type_impl::compare_bytes(b1, b2);
auto c2 = timeuuid_type_impl::compare_bytes(b2, b1);
// Require strict ordering
if (c1 != c2) {
return c1;
auto c = timeuuid_type_impl::compare_bytes(b1, b2);
if (c) {
return c < 0;
}
}
return less_unsigned(b1, b2);