Skip to content

Commit ac7bcfe

Browse files
committed
Remove call to MaxBigValue for non-RANGE functions.
1 parent 3d16864 commit ac7bcfe

File tree

1 file changed

+7
-4
lines changed

1 file changed

+7
-4
lines changed

roaring64/bsi64.go

Lines changed: 7 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -318,7 +318,7 @@ func (b *BSI) CompareBigValue(parallelism int, op Operation, valueOrStart, end *
318318
if valueOrStart == nil {
319319
valueOrStart = b.MinMaxBig(parallelism, MIN, &b.eBM)
320320
}
321-
if end == nil {
321+
if end == nil && op == RANGE {
322322
end = b.MinMaxBig(parallelism, MAX, &b.eBM)
323323
}
324324

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

388388
startIsNegative := e.valueOrStart.Sign() == -1
389-
endIsNegative := e.end.Sign() == -1
389+
endIsNegative := true
390+
if e.end != nil {
391+
endIsNegative = e.end.Sign() == -1
392+
}
390393

391394
for i := 0; i < len(batch); i++ {
392395
cID := batch[i]
@@ -735,12 +738,12 @@ func (b *BSI) ParOr(parallelism int, bsis ...*BSI) {
735738
bits := len(b.bA)
736739
for i := 0; i < len(bsis); i++ {
737740
if len(bsis[i].bA) > bits {
738-
bits = bsis[i].BitCount()
741+
bits = len(bsis[i].bA )
739742
}
740743
}
741744

742745
// Make sure we have enough bit slices
743-
for bits > b.BitCount() {
746+
for bits > len(b.bA) {
744747
bm := Bitmap{}
745748
bm.RunOptimize()
746749
b.bA = append(b.bA, bm)

0 commit comments

Comments
 (0)