From 9fee29c0c2135d1c110a24057fee460bde349b3f Mon Sep 17 00:00:00 2001 From: Daniel Lemire Date: Sat, 21 Oct 2017 11:49:03 -0400 Subject: [PATCH] Applying golint --- bitmapcontainer.go | 4 ++-- parallel.go | 8 +++++++- rlei.go | 6 +++--- roaring_test.go | 2 +- 4 files changed, 13 insertions(+), 7 deletions(-) diff --git a/bitmapcontainer.go b/bitmapcontainer.go index 6c16cedb..a02655b0 100644 --- a/bitmapcontainer.go +++ b/bitmapcontainer.go @@ -48,7 +48,7 @@ func newBitmapContainerwithRange(firstOfRun, lastOfRun int) *bitmapContainer { } func (bc *bitmapContainer) minimum() uint16 { - for i := 0; i < len(bc.bitmap); i += 1 { + for i := 0; i < len(bc.bitmap); i++ { w := bc.bitmap[i] if w != 0 { r := countTrailingZeros(w) @@ -86,7 +86,7 @@ func clz(i uint64) int { } func (bc *bitmapContainer) maximum() uint16 { - for i := len(bc.bitmap); i > 0; i -= 1 { + for i := len(bc.bitmap); i > 0; i-- { w := bc.bitmap[i-1] if w != 0 { r := clz(w) diff --git a/parallel.go b/parallel.go index 2704e446..69f13ab1 100644 --- a/parallel.go +++ b/parallel.go @@ -155,7 +155,7 @@ func appenderRoutine(bitmapChan chan<- *Bitmap, resultChan <-chan keyedContainer keys[item.idx] = item.key containers[item.idx] = item.container - appendedKeys += 1 + appendedKeys++ case msg := <-expectedKeysChan: expectedKeys = msg } @@ -176,6 +176,9 @@ func appenderRoutine(bitmapChan chan<- *Bitmap, resultChan <-chan keyedContainer bitmapChan <- answer } +// ParOr computes the union (OR) of all provided bitmaps in parallel, +// where the parameter "parallelism" determines how many workers are to be used +// (if it is set to 0, a default number of workers is chosen) func ParOr(parallelism int, bitmaps ...*Bitmap) *Bitmap { bitmapCount := len(bitmaps) if bitmapCount == 0 { @@ -244,6 +247,9 @@ func ParOr(parallelism int, bitmaps ...*Bitmap) *Bitmap { return bitmap } +// ParAnd computes the intersection (AND) of all provided bitmaps in parallel, +// where the parameter "parallelism" determines how many workers are to be used +// (if it is set to 0, a default number of workers is chosen) func ParAnd(parallelism int, bitmaps ...*Bitmap) *Bitmap { bitmapCount := len(bitmaps) if bitmapCount == 0 { diff --git a/rlei.go b/rlei.go index af1f88ff..0da3422a 100644 --- a/rlei.go +++ b/rlei.go @@ -79,15 +79,15 @@ func (rc *runContainer16) andArrayCardinality(ac *arrayContainer) int { mainloop: for _, p := range rc.iv { for v < p.start { - pos += 1 + pos++ if pos == maxpos { break mainloop } v = ac.content[pos] } for v <= p.last { - answer += 1 - pos += 1 + answer++ + pos++ if pos == maxpos { break mainloop } diff --git a/roaring_test.go b/roaring_test.go index 8a665b36..171ded6d 100644 --- a/roaring_test.go +++ b/roaring_test.go @@ -23,7 +23,7 @@ func TestFirstLast(t *testing.T) { t.FailNow() } i := 1 << 5 - for ; i < (1 << 17); i += 1 { + for ; i < (1 << 17); i++ { bm.AddInt(i) if 2 != bm.Minimum() { t.Errorf("bad minimum")