MCPcopy Create free account
hub / github.com/ceph/ceph / intersection_size_asym

Method intersection_size_asym

src/include/interval_set.h:336–384  ·  view source on GitHub ↗

Source from the content-addressed store, hash-verified

334 }
335
336 void intersection_size_asym(const interval_set &s, const interval_set &l) {
337 auto ps = s.m.begin();
338 ceph_assert(ps != s.m.end());
339 auto offset = ps->first;
340 bool first = true;
341 auto mi = m.begin();
342
343 while (1) {
344 if (first)
345 first = false;
346 auto pl = l.find_inc(offset);
347 if (pl == l.m.end())
348 break;
349 while (ps != s.m.end() && ps->first + ps->second <= pl->first)
350 ++ps;
351 if (ps == s.m.end())
352 break;
353 offset = pl->first + pl->second;
354 if (offset <= ps->first) {
355 offset = ps->first;
356 continue;
357 }
358
359 if (*ps == *pl) {
360 do {
361 mi = m.insert(mi, *ps);
362 _size += ps->second;
363 ++ps;
364 ++pl;
365 } while (ps != s.m.end() && pl != l.m.end() && *ps == *pl);
366 if (ps == s.m.end())
367 break;
368 offset = ps->first;
369 continue;
370 }
371
372 auto start = std::max<T>(ps->first, pl->first);
373 auto en = std::min<T>(ps->first + ps->second, offset);
374 strict_mode_assert(en > start);
375 mi = m.emplace_hint(mi, start, en - start);
376 _size += mi->second;
377 if (ps->first + ps->second <= offset) {
378 ++ps;
379 if (ps == s.m.end())
380 break;
381 offset = ps->first;
382 }
383 }
384 }
385
386 bool subset_size_sym(const interval_set &b) const {
387 auto pa = m.begin(), pb = b.m.begin();

Callers

nothing calls this directly

Calls 5

beginMethod · 0.45
endMethod · 0.45
find_incMethod · 0.45
insertMethod · 0.45
emplace_hintMethod · 0.45

Tested by

no test coverage detected