diff options
author | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-03-31 10:54:08 +0300 |
---|---|---|
committer | Daniil Cherednik <dan.cherednik@gmail.com> | 2023-03-31 12:28:07 +0300 |
commit | fc1cffcfa7f0497a1f97b384a24bcbf23362f3be (patch) | |
tree | c15f7ab5b9e9b20fd0ef8fc07d598d28e8b32004 /library/cpp/actors/util/rc_buf.h | |
parent | 8a749596d40e91c896a1907afcd108d9221fbde1 (diff) | |
download | ydb-e9cbe5c5cf67db853d223fd365c9f05b695f7b96.tar.gz |
Ydb stable 23-1-1923.1.19
x-stable-origin-commit: c5d5a396e89d0a72e0267a55e93d8404d4fb54fe
Diffstat (limited to 'library/cpp/actors/util/rc_buf.h')
-rw-r--r-- | library/cpp/actors/util/rc_buf.h | 7 |
1 files changed, 4 insertions, 3 deletions
diff --git a/library/cpp/actors/util/rc_buf.h b/library/cpp/actors/util/rc_buf.h index 1a492064ee..a2bce33fba 100644 --- a/library/cpp/actors/util/rc_buf.h +++ b/library/cpp/actors/util/rc_buf.h @@ -113,10 +113,11 @@ public: private: static int Compare(const TContiguousSpan& x, const TContiguousSpan& y) { - if (int res = std::memcmp(x.data(), y.data(), std::min(x.size(), y.size())); res) { - return res; + int res = 0; + if (const size_t common = std::min(x.size(), y.size())) { + res = std::memcmp(x.data(), y.data(), common); } - return x.size() - y.size(); + return res ? res : x.size() - y.size(); } }; |