MCPcopy Index your code
hub / github.com/RoaringBitmap/roaring / lazyIOrOnRange

Function lazyIOrOnRange

parallel.go:554–612  ·  view source on GitHub ↗
(ra1, ra2 *roaringArray, start, last uint16)

Source from the content-addressed store, hash-verified

552}
553
554func lazyIOrOnRange(ra1, ra2 *roaringArray, start, last uint16) *roaringArray {
555 length1 := ra1.size()
556 length2 := ra2.size()
557
558 idx1 := 0
559 idx2 := parNaiveStartAt(ra2, start, last)
560
561 var key1 uint16
562 var key2 uint16
563 if idx1 < length1 && idx2 < length2 {
564 key1 = ra1.getKeyAtIndex(idx1)
565 key2 = ra2.getKeyAtIndex(idx2)
566
567 for key1 <= last && key2 <= last {
568 if key1 < key2 {
569 idx1++
570 if idx1 >= length1 {
571 break
572 }
573 key1 = ra1.getKeyAtIndex(idx1)
574 } else if key1 > key2 {
575 ra1.insertNewKeyValueAt(idx1, key2, ra2.getContainerAtIndex(idx2))
576 ra1.needCopyOnWrite[idx1] = true
577 idx2++
578 idx1++
579 length1++
580 if idx2 >= length2 {
581 break
582 }
583 key2 = ra2.getKeyAtIndex(idx2)
584 } else {
585 c1 := ra1.getFastContainerAtIndex(idx1, true)
586
587 ra1.containers[idx1] = c1.lazyIOR(ra2.getContainerAtIndex(idx2))
588 ra1.needCopyOnWrite[idx1] = false
589 idx1++
590 idx2++
591 if idx1 >= length1 || idx2 >= length2 {
592 break
593 }
594
595 key1 = ra1.getKeyAtIndex(idx1)
596 key2 = ra2.getKeyAtIndex(idx2)
597 }
598 }
599 }
600 if idx2 < length2 {
601 key2 = ra2.getKeyAtIndex(idx2)
602 for key2 <= last {
603 ra1.appendCopy(*ra2, idx2)
604 idx2++
605 if idx2 >= length2 {
606 break
607 }
608 key2 = ra2.getKeyAtIndex(idx2)
609 }
610 }
611 return ra1

Callers 1

ParOrFunction · 0.85

Calls 8

parNaiveStartAtFunction · 0.70
lazyIORMethod · 0.65
sizeMethod · 0.45
getKeyAtIndexMethod · 0.45
insertNewKeyValueAtMethod · 0.45
getContainerAtIndexMethod · 0.45
appendCopyMethod · 0.45

Tested by

no test coverage detected

Used in the wild real call sites across dependent graphs

searching dependent graphs…