From 679d10a7aefe31ed65cf0724826d4de56dba2114 Mon Sep 17 00:00:00 2001 From: Alex Ainscow Date: Thu, 23 Jan 2025 08:39:53 +0000 Subject: [PATCH] interval_map: Review comments Signed-off-by: Alex Ainscow --- src/common/interval_map.h | 8 ++------ 1 file changed, 2 insertions(+), 6 deletions(-) diff --git a/src/common/interval_map.h b/src/common/interval_map.h index 8e0d07f06eb48..433a018da9d24 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 { -- 2.39.5