From: Alex Ainscow Date: Thu, 23 Jan 2025 08:39:53 +0000 (+0000) Subject: interval_map: Review comments X-Git-Tag: testing/wip-pdonnell-testing-20250130.221602-debug~2^2~4 X-Git-Url: http://git.apps.os.sepia.ceph.com/?a=commitdiff_plain;h=679d10a7aefe31ed65cf0724826d4de56dba2114;p=ceph-ci.git interval_map: Review comments Signed-off-by: Alex Ainscow --- diff --git a/src/common/interval_map.h b/src/common/interval_map.h index 8e0d07f06eb..433a018da9d 100644 --- a/src/common/interval_map.h +++ b/src/common/interval_map.h @@ -51,11 +51,7 @@ class interval_map { } std::pair get_range(K off, K len) const { // fst is first iterator with end after off (may be end) - auto fst = m.upper_bound(off); - if (fst != m.begin()) - --fst; - if (fst != m.end() && off >= (fst->first + fst->second.first)) - ++fst; + auto fst = get_range_fst(off); // lst is first iterator with start after off + len (may be end) auto lst = m.lower_bound(off + len); @@ -258,7 +254,7 @@ public: constexpr bool contains(K _off, K _len) const { K off = get_off(); K len = get_len(); - return off <= _off && off + len >= _off + _len; + return off <= _off && _off + _len <= off + len; } }; const_iterator begin() const {