Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix 459 #460

Merged
merged 2 commits into from
Nov 9, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
13 changes: 8 additions & 5 deletions roaring64/bsi64.go
Original file line number Diff line number Diff line change
Expand Up @@ -318,7 +318,7 @@ func (b *BSI) CompareBigValue(parallelism int, op Operation, valueOrStart, end *
if valueOrStart == nil {
valueOrStart = b.MinMaxBig(parallelism, MIN, &b.eBM)
}
if end == nil {
if end == nil && op == RANGE {
end = b.MinMaxBig(parallelism, MAX, &b.eBM)
}

Expand Down Expand Up @@ -386,7 +386,10 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa
}

startIsNegative := e.valueOrStart.Sign() == -1
endIsNegative := e.end.Sign() == -1
endIsNegative := true
if e.end != nil {
endIsNegative = e.end.Sign() == -1
}

for i := 0; i < len(batch); i++ {
cID := batch[i]
Expand All @@ -399,7 +402,7 @@ func compareValue(e *task, batch []uint64, resultsChan chan *Bitmap, wg *sync.Wa
if isNegative != startIsNegative {
compStartValue = twosComplement(e.valueOrStart, e.bsi.BitCount()+1)
}
if isNegative != endIsNegative {
if isNegative != endIsNegative && e.end != nil {
compEndValue = twosComplement(e.end, e.bsi.BitCount()+1)
}

Expand Down Expand Up @@ -735,12 +738,12 @@ func (b *BSI) ParOr(parallelism int, bsis ...*BSI) {
bits := len(b.bA)
for i := 0; i < len(bsis); i++ {
if len(bsis[i].bA) > bits {
bits = bsis[i].BitCount()
bits = len(bsis[i].bA )
}
}

// Make sure we have enough bit slices
for bits > b.BitCount() {
for bits > len(b.bA) {
bm := Bitmap{}
bm.RunOptimize()
b.bA = append(b.bA, bm)
Expand Down
Loading