]> git.apps.os.sepia.ceph.com Git - ceph-ci.git/commitdiff
interval_map: Review comments
authorAlex Ainscow <aainscow@uk.ibm.com>
Thu, 23 Jan 2025 08:39:53 +0000 (08:39 +0000)
committerAlex Ainscow <aainscow@uk.ibm.com>
Mon, 27 Jan 2025 11:20:01 +0000 (11:20 +0000)
Signed-off-by: Alex Ainscow <aainscow@uk.ibm.com>
src/common/interval_map.h

index 8e0d07f06eb480defbbab6d7faf5f23467d291a7..433a018da9d24e8db2e550852d26d8f4168fe57e 100644 (file)
@@ -51,11 +51,7 @@ class interval_map {
   }
   std::pair<cmapiter, cmapiter> 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 {