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

Function mergeInterval16s

runcontainer.go:322–340  ·  view source on GitHub ↗

mergeInterval16s joins a and b into a new interval, and panics if it cannot.

(a, b interval16)

Source from the content-addressed store, hash-verified

320// mergeInterval16s joins a and b into a
321// new interval, and panics if it cannot.
322func mergeInterval16s(a, b interval16) (res interval16) {
323 if !canMerge16(a, b) {
324 panic(fmt.Sprintf("cannot merge %#v and %#v", a, b))
325 }
326
327 if b.start < a.start {
328 res.start = b.start
329 } else {
330 res.start = a.start
331 }
332
333 if b.last() > a.last() {
334 res.length = b.last() - res.start
335 } else {
336 res.length = a.last() - res.start
337 }
338
339 return
340}
341
342// intersectInterval16s returns the intersection
343// of a and b. The isEmpty flag will be true if

Callers 3

TestRleInterval16sFunction · 0.85
unionMethod · 0.85
unionCardinalityMethod · 0.85

Calls 2

canMerge16Function · 0.85
lastMethod · 0.80

Tested by 1

TestRleInterval16sFunction · 0.68

Used in the wild real call sites across dependent graphs

searching dependent graphs…