MCPcopy Create free account
hub / github.com/RoaringBitmap/roaring / intersectInterval16s

Function intersectInterval16s

runcontainer.go:345–367  ·  view source on GitHub ↗

intersectInterval16s returns the intersection of a and b. The isEmpty flag will be true if a and b were disjoint.

(a, b interval16)

Source from the content-addressed store, hash-verified

343// of a and b. The isEmpty flag will be true if
344// a and b were disjoint.
345func intersectInterval16s(a, b interval16) (res interval16, isEmpty bool) {
346 if !haveOverlap16(a, b) {
347 isEmpty = true
348 return
349 }
350 if b.start > a.start {
351 res.start = b.start
352 } else {
353 res.start = a.start
354 }
355
356 bEnd := b.last()
357 aEnd := a.last()
358 var resEnd uint16
359
360 if bEnd < aEnd {
361 resEnd = bEnd
362 } else {
363 resEnd = aEnd
364 }
365 res.length = resEnd - res.start
366 return
367}
368
369// union merges two runContainer16s, producing
370// a new runContainer16 with the union of rc and b.

Callers 4

TestRleInterval16sFunction · 0.85
subtractIntervalMethod · 0.85
isubtractMethod · 0.85

Calls 2

haveOverlap16Function · 0.85
lastMethod · 0.80

Tested by 2

TestRleInterval16sFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…