Skip to content

Commit

Permalink
Add Roaring level comments
Browse files Browse the repository at this point in the history
  • Loading branch information
bstrausser committed Jun 10, 2024
1 parent a12ccef commit 01a02e5
Showing 1 changed file with 16 additions and 0 deletions.
16 changes: 16 additions & 0 deletions roaring.go
Original file line number Diff line number Diff line change
Expand Up @@ -1878,6 +1878,10 @@ func (rb *Bitmap) CloneCopyOnWriteContainers() {
rb.highlowcontainer.cloneCopyOnWriteContainers()
}

// NextValue returns the next largest value in the bitmap, or -1
// if none is present. This function should not be used inside
// a performance-sensitive loop: prefer iterators if
// performance is a concern.
func (rb *Bitmap) NextValue(target uint32) int64 {
originalKey := highbits(target)
query := lowbits(target)
Expand Down Expand Up @@ -1910,6 +1914,10 @@ func (rb *Bitmap) NextValue(target uint32) int64 {
return int64(nextValue)
}

// PreviousValue returns the previous largest value in the bitmap, or -1
// if none is present. This function should not be used inside
// a performance-sensitive loop: prefer iterators if
// performance is a concern.
func (rb *Bitmap) PreviousValue(target uint32) int64 {
if rb.IsEmpty() {
return -1
Expand Down Expand Up @@ -1956,6 +1964,10 @@ func (rb *Bitmap) PreviousValue(target uint32) int64 {
return int64(prevValue)
}

// NextAbsentValue returns the next largest missing value in the bitmap, or -1
// if none is present. This function should not be used inside
// a performance-sensitive loop: prefer iterators if
// performance is a concern.
func (rb *Bitmap) NextAbsentValue(target uint32) int64 {
originalKey := highbits(target)
query := lowbits(target)
Expand Down Expand Up @@ -2003,6 +2015,10 @@ func (rb *Bitmap) NextAbsentValue(target uint32) int64 {
}
}

// PreviousAbsentValue returns the previous largest missing value in the bitmap, or -1
// if none is present. This function should not be used inside
// a performance-sensitive loop: prefer iterators if
// performance is a concern.
func (rb *Bitmap) PreviousAbsentValue(target uint32) int64 {
originalKey := highbits(target)
query := lowbits(target)
Expand Down

0 comments on commit 01a02e5

Please sign in to comment.