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

Method AddRange

roaring64/roaring64.go:1054–1076  ·  view source on GitHub ↗

AddRange adds the integers in [rangeStart, rangeEnd) to the bitmap.

(rangeStart, rangeEnd uint64)

Source from the content-addressed store, hash-verified

1052
1053// AddRange adds the integers in [rangeStart, rangeEnd) to the bitmap.
1054func (rb *Bitmap) AddRange(rangeStart, rangeEnd uint64) {
1055 if rangeStart >= rangeEnd {
1056 return
1057 }
1058 hbStart := uint64(highbits(rangeStart))
1059 lbStart := uint64(lowbits(rangeStart))
1060 hbLast := uint64(highbits(rangeEnd - 1))
1061 lbLast := uint64(lowbits(rangeEnd - 1))
1062
1063 var max uint64 = maxLowBit
1064 for hb := hbStart; hb <= hbLast; hb++ {
1065 containerStart := uint64(0)
1066 if hb == hbStart {
1067 containerStart = lbStart
1068 }
1069 containerLast := max
1070 if hb == hbLast {
1071 containerLast = lbLast
1072 }
1073
1074 rb.getOrCreateContainer(uint32(hb)).AddRange(containerStart, containerLast+1)
1075 }
1076}
1077
1078// RemoveRange removes the integers in [rangeStart, rangeEnd) from the bitmap.
1079func (rb *Bitmap) RemoveRange(rangeStart, rangeEnd uint64) {

Callers 15

TestFastCardCOWFunction · 0.95
TestIntersects1COWFunction · 0.95
TestRangePanicCOWFunction · 0.95
TestRangeRemovalCOWFunction · 0.95
TestDoubleAddCOWFunction · 0.95
TestCloneCOWContainersFunction · 0.95
TestFastCardFunction · 0.95
TestIntersects1Function · 0.95
TestRangePanicFunction · 0.95
TestRangeRemovalFunction · 0.95

Calls 3

getOrCreateContainerMethod · 0.95
highbitsFunction · 0.70
lowbitsFunction · 0.70

Tested by 15

TestFastCardCOWFunction · 0.76
TestIntersects1COWFunction · 0.76
TestRangePanicCOWFunction · 0.76
TestRangeRemovalCOWFunction · 0.76
TestDoubleAddCOWFunction · 0.76
TestCloneCOWContainersFunction · 0.76
TestFastCardFunction · 0.76
TestIntersects1Function · 0.76
TestRangePanicFunction · 0.76
TestRangeRemovalFunction · 0.76