Vendor Update Go Libs (#13166)
* update github.com/alecthomas/chroma v0.8.0 -> v0.8.1 * github.com/blevesearch/bleve v1.0.10 -> v1.0.12 * editorconfig-core-go v2.1.1 -> v2.3.7 * github.com/gliderlabs/ssh v0.2.2 -> v0.3.1 * migrate editorconfig.ParseBytes to Parse * github.com/shurcooL/vfsgen to 0d455de96546 * github.com/go-git/go-git/v5 v5.1.0 -> v5.2.0 * github.com/google/uuid v1.1.1 -> v1.1.2 * github.com/huandu/xstrings v1.3.0 -> v1.3.2 * github.com/klauspost/compress v1.10.11 -> v1.11.1 * github.com/markbates/goth v1.61.2 -> v1.65.0 * github.com/mattn/go-sqlite3 v1.14.0 -> v1.14.4 * github.com/mholt/archiver v3.3.0 -> v3.3.2 * github.com/microcosm-cc/bluemonday 4f7140c49acb -> v1.0.4 * github.com/minio/minio-go v7.0.4 -> v7.0.5 * github.com/olivere/elastic v7.0.9 -> v7.0.20 * github.com/urfave/cli v1.20.0 -> v1.22.4 * github.com/prometheus/client_golang v1.1.0 -> v1.8.0 * github.com/xanzy/go-gitlab v0.37.0 -> v0.38.1 * mvdan.cc/xurls v2.1.0 -> v2.2.0 Co-authored-by: Lauris BH <lauris@nix.lv>
This commit is contained in:
		
							parent
							
								
									91f2afdb54
								
							
						
					
					
						commit
						12a1f914f4
					
				
					 656 changed files with 52967 additions and 25229 deletions
				
			
		
							
								
								
									
										6
									
								
								vendor/github.com/RoaringBitmap/roaring/.travis.yml
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										6
									
								
								vendor/github.com/RoaringBitmap/roaring/.travis.yml
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -8,13 +8,9 @@ install:
 | 
			
		|||
notifications:
 | 
			
		||||
  email: false
 | 
			
		||||
go:
 | 
			
		||||
- "1.7.x"
 | 
			
		||||
- "1.8.x"
 | 
			
		||||
- "1.9.x"
 | 
			
		||||
- "1.10.x"
 | 
			
		||||
- "1.11.x"
 | 
			
		||||
- "1.12.x"
 | 
			
		||||
- "1.13.x"
 | 
			
		||||
- "1.14.x"
 | 
			
		||||
- tip
 | 
			
		||||
 | 
			
		||||
# whitelist
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										70
									
								
								vendor/github.com/RoaringBitmap/roaring/README.md
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										70
									
								
								vendor/github.com/RoaringBitmap/roaring/README.md
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,5 +1,9 @@
 | 
			
		|||
roaring [](https://travis-ci.org/RoaringBitmap/roaring) [](https://coveralls.io/github/RoaringBitmap/roaring?branch=master) [](https://godoc.org/github.com/RoaringBitmap/roaring) [](https://goreportcard.com/report/github.com/RoaringBitmap/roaring)
 | 
			
		||||
roaring [](https://travis-ci.org/RoaringBitmap/roaring) [](https://godoc.org/github.com/RoaringBitmap/roaring) [](https://godoc.org/github.com/RoaringBitmap/roaring/roaring64) [](https://goreportcard.com/report/github.com/RoaringBitmap/roaring)
 | 
			
		||||
[](https://cloud.drone.io/RoaringBitmap/roaring)
 | 
			
		||||

 | 
			
		||||

 | 
			
		||||

 | 
			
		||||

 | 
			
		||||
=============
 | 
			
		||||
 | 
			
		||||
This is a go version of the Roaring bitmap data structure. 
 | 
			
		||||
| 
						 | 
				
			
			@ -7,7 +11,7 @@ This is a go version of the Roaring bitmap data structure.
 | 
			
		|||
 | 
			
		||||
 | 
			
		||||
Roaring bitmaps are used by several major systems such as [Apache Lucene][lucene] and derivative systems such as [Solr][solr] and
 | 
			
		||||
[Elasticsearch][elasticsearch], [Apache Druid (Incubating)][druid], [LinkedIn Pinot][pinot], [Netflix Atlas][atlas],  [Apache Spark][spark], [OpenSearchServer][opensearchserver], [Cloud Torrent][cloudtorrent], [Whoosh][whoosh],  [Pilosa][pilosa],  [Microsoft Visual Studio Team Services (VSTS)][vsts], and eBay's [Apache Kylin][kylin].
 | 
			
		||||
[Elasticsearch][elasticsearch], [Apache Druid (Incubating)][druid], [LinkedIn Pinot][pinot], [Netflix Atlas][atlas],  [Apache Spark][spark], [OpenSearchServer][opensearchserver], [Cloud Torrent][cloudtorrent], [Whoosh][whoosh],  [Pilosa][pilosa],  [Microsoft Visual Studio Team Services (VSTS)][vsts], and eBay's [Apache Kylin][kylin]. The YouTube SQL Engine, [Google Procella](https://research.google/pubs/pub48388/), uses Roaring bitmaps for indexing.
 | 
			
		||||
 | 
			
		||||
[lucene]: https://lucene.apache.org/
 | 
			
		||||
[solr]: https://lucene.apache.org/solr/
 | 
			
		||||
| 
						 | 
				
			
			@ -172,10 +176,70 @@ That is, given a fixed overhead for the universe size (x), Roaring
 | 
			
		|||
bitmaps never use more than 2 bytes per integer. You can call
 | 
			
		||||
``BoundSerializedSizeInBytes`` for a more precise estimate.
 | 
			
		||||
 | 
			
		||||
### 64-bit Roaring
 | 
			
		||||
 | 
			
		||||
By default, roaring is used to stored unsigned 32-bit integers. However, we also offer
 | 
			
		||||
an extension dedicated to 64-bit integers. It supports roughly the same functions:
 | 
			
		||||
 | 
			
		||||
```go
 | 
			
		||||
package main
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
    "fmt"
 | 
			
		||||
    "github.com/RoaringBitmap/roaring/roaring64"
 | 
			
		||||
    "bytes"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
func main() {
 | 
			
		||||
    // example inspired by https://github.com/fzandona/goroar
 | 
			
		||||
    fmt.Println("==roaring64==")
 | 
			
		||||
    rb1 := roaring64.BitmapOf(1, 2, 3, 4, 5, 100, 1000)
 | 
			
		||||
    fmt.Println(rb1.String())
 | 
			
		||||
 | 
			
		||||
    rb2 := roaring64.BitmapOf(3, 4, 1000)
 | 
			
		||||
    fmt.Println(rb2.String())
 | 
			
		||||
 | 
			
		||||
    rb3 := roaring64.New()
 | 
			
		||||
    fmt.Println(rb3.String())
 | 
			
		||||
 | 
			
		||||
    fmt.Println("Cardinality: ", rb1.GetCardinality())
 | 
			
		||||
 | 
			
		||||
    fmt.Println("Contains 3? ", rb1.Contains(3))
 | 
			
		||||
 | 
			
		||||
    rb1.And(rb2)
 | 
			
		||||
 | 
			
		||||
    rb3.Add(1)
 | 
			
		||||
    rb3.Add(5)
 | 
			
		||||
 | 
			
		||||
    rb3.Or(rb1)
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
    // prints 1, 3, 4, 5, 1000
 | 
			
		||||
    i := rb3.Iterator()
 | 
			
		||||
    for i.HasNext() {
 | 
			
		||||
        fmt.Println(i.Next())
 | 
			
		||||
    }
 | 
			
		||||
    fmt.Println()
 | 
			
		||||
 | 
			
		||||
    // next we include an example of serialization
 | 
			
		||||
    buf := new(bytes.Buffer)
 | 
			
		||||
    rb1.WriteTo(buf) // we omit error handling
 | 
			
		||||
    newrb:= roaring64.New()
 | 
			
		||||
    newrb.ReadFrom(buf)
 | 
			
		||||
    if rb1.Equals(newrb) {
 | 
			
		||||
    	fmt.Println("I wrote the content to a byte stream and read it back.")
 | 
			
		||||
    }
 | 
			
		||||
    // you can iterate over bitmaps using ReverseIterator(), Iterator, ManyIterator()
 | 
			
		||||
}
 | 
			
		||||
```
 | 
			
		||||
 | 
			
		||||
Only the 32-bit roaring format is standard and cross-operable between Java, C++, C and Go. There is no guarantee that the 64-bit versions are compatible.
 | 
			
		||||
 | 
			
		||||
### Documentation
 | 
			
		||||
 | 
			
		||||
Current documentation is available at http://godoc.org/github.com/RoaringBitmap/roaring
 | 
			
		||||
Current documentation is available at http://godoc.org/github.com/RoaringBitmap/roaring and http://godoc.org/github.com/RoaringBitmap/roaring64
 | 
			
		||||
 | 
			
		||||
### Goroutine safety
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										35
									
								
								vendor/github.com/RoaringBitmap/roaring/arraycontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										35
									
								
								vendor/github.com/RoaringBitmap/roaring/arraycontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -876,6 +876,41 @@ func (ac *arrayContainer) loadData(bitmapContainer *bitmapContainer) {
 | 
			
		|||
	ac.content = make([]uint16, bitmapContainer.cardinality, bitmapContainer.cardinality)
 | 
			
		||||
	bitmapContainer.fillArray(ac.content)
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ac *arrayContainer) resetTo(a container) {
 | 
			
		||||
	switch x := a.(type) {
 | 
			
		||||
	case *arrayContainer:
 | 
			
		||||
		ac.realloc(len(x.content))
 | 
			
		||||
		copy(ac.content, x.content)
 | 
			
		||||
 | 
			
		||||
	case *bitmapContainer:
 | 
			
		||||
		ac.realloc(x.cardinality)
 | 
			
		||||
		x.fillArray(ac.content)
 | 
			
		||||
 | 
			
		||||
	case *runContainer16:
 | 
			
		||||
		card := int(x.cardinality())
 | 
			
		||||
		ac.realloc(card)
 | 
			
		||||
		cur := 0
 | 
			
		||||
		for _, r := range x.iv {
 | 
			
		||||
			for val := r.start; val <= r.last(); val++ {
 | 
			
		||||
				ac.content[cur] = val
 | 
			
		||||
				cur++
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		panic("unsupported container type")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ac *arrayContainer) realloc(size int) {
 | 
			
		||||
	if cap(ac.content) < size {
 | 
			
		||||
		ac.content = make([]uint16, size)
 | 
			
		||||
	} else {
 | 
			
		||||
		ac.content = ac.content[:size]
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newArrayContainer() *arrayContainer {
 | 
			
		||||
	p := new(arrayContainer)
 | 
			
		||||
	return p
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										53
									
								
								vendor/github.com/RoaringBitmap/roaring/bitmapcontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										53
									
								
								vendor/github.com/RoaringBitmap/roaring/bitmapcontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -203,6 +203,33 @@ func (bcmi *bitmapContainerManyIterator) nextMany(hs uint32, buf []uint32) int {
 | 
			
		|||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (bcmi *bitmapContainerManyIterator) nextMany64(hs uint64, buf []uint64) int {
 | 
			
		||||
	n := 0
 | 
			
		||||
	base := bcmi.base
 | 
			
		||||
	bitset := bcmi.bitset
 | 
			
		||||
 | 
			
		||||
	for n < len(buf) {
 | 
			
		||||
		if bitset == 0 {
 | 
			
		||||
			base++
 | 
			
		||||
			if base >= len(bcmi.ptr.bitmap) {
 | 
			
		||||
				bcmi.base = base
 | 
			
		||||
				bcmi.bitset = bitset
 | 
			
		||||
				return n
 | 
			
		||||
			}
 | 
			
		||||
			bitset = bcmi.ptr.bitmap[base]
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
		t := bitset & -bitset
 | 
			
		||||
		buf[n] = uint64(((base * 64) + int(popcount(t-1)))) | hs
 | 
			
		||||
		n = n + 1
 | 
			
		||||
		bitset ^= t
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	bcmi.base = base
 | 
			
		||||
	bcmi.bitset = bitset
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newBitmapContainerManyIterator(a *bitmapContainer) *bitmapContainerManyIterator {
 | 
			
		||||
	return &bitmapContainerManyIterator{a, -1, 0}
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			@ -934,6 +961,32 @@ func (bc *bitmapContainer) loadData(arrayContainer *arrayContainer) {
 | 
			
		|||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (bc *bitmapContainer) resetTo(a container) {
 | 
			
		||||
	switch x := a.(type) {
 | 
			
		||||
	case *arrayContainer:
 | 
			
		||||
		fill(bc.bitmap, 0)
 | 
			
		||||
		bc.loadData(x)
 | 
			
		||||
 | 
			
		||||
	case *bitmapContainer:
 | 
			
		||||
		bc.cardinality = x.cardinality
 | 
			
		||||
		copy(bc.bitmap, x.bitmap)
 | 
			
		||||
 | 
			
		||||
	case *runContainer16:
 | 
			
		||||
		bc.cardinality = len(x.iv)
 | 
			
		||||
		lastEnd := 0
 | 
			
		||||
		for _, r := range x.iv {
 | 
			
		||||
			bc.cardinality += int(r.length)
 | 
			
		||||
			resetBitmapRange(bc.bitmap, lastEnd, int(r.start))
 | 
			
		||||
			lastEnd = int(r.start+r.length) + 1
 | 
			
		||||
			setBitmapRange(bc.bitmap, int(r.start), lastEnd)
 | 
			
		||||
		}
 | 
			
		||||
		resetBitmapRange(bc.bitmap, lastEnd, maxCapacity)
 | 
			
		||||
 | 
			
		||||
	default:
 | 
			
		||||
		panic("unsupported container type")
 | 
			
		||||
	}
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (bc *bitmapContainer) toArrayContainer() *arrayContainer {
 | 
			
		||||
	ac := &arrayContainer{}
 | 
			
		||||
	ac.loadData(bc)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										117
									
								
								vendor/github.com/RoaringBitmap/roaring/fastaggregation.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										117
									
								
								vendor/github.com/RoaringBitmap/roaring/fastaggregation.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -213,3 +213,120 @@ func HeapXor(bitmaps ...*Bitmap) *Bitmap {
 | 
			
		|||
	}
 | 
			
		||||
	return heap.Pop(&pq).(*item).value
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// AndAny provides a result equivalent to x1.And(FastOr(bitmaps)).
 | 
			
		||||
// It's optimized to minimize allocations. It also might be faster than separate calls.
 | 
			
		||||
func (x1 *Bitmap) AndAny(bitmaps ...*Bitmap) {
 | 
			
		||||
	if len(bitmaps) == 0 {
 | 
			
		||||
		return
 | 
			
		||||
	} else if len(bitmaps) == 1 {
 | 
			
		||||
		x1.And(bitmaps[0])
 | 
			
		||||
		return
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	type withPos struct {
 | 
			
		||||
		bitmap *roaringArray
 | 
			
		||||
		pos    int
 | 
			
		||||
		key    uint16
 | 
			
		||||
	}
 | 
			
		||||
	filters := make([]withPos, 0, len(bitmaps))
 | 
			
		||||
 | 
			
		||||
	for _, b := range bitmaps {
 | 
			
		||||
		if b.highlowcontainer.size() > 0 {
 | 
			
		||||
			filters = append(filters, withPos{
 | 
			
		||||
				bitmap: &b.highlowcontainer,
 | 
			
		||||
				pos:    0,
 | 
			
		||||
				key:    b.highlowcontainer.getKeyAtIndex(0),
 | 
			
		||||
			})
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	basePos := 0
 | 
			
		||||
	intersections := 0
 | 
			
		||||
	keyContainers := make([]container, 0, len(filters))
 | 
			
		||||
	var (
 | 
			
		||||
		tmpArray   *arrayContainer
 | 
			
		||||
		tmpBitmap  *bitmapContainer
 | 
			
		||||
		minNextKey uint16
 | 
			
		||||
	)
 | 
			
		||||
 | 
			
		||||
	for basePos < x1.highlowcontainer.size() && len(filters) > 0 {
 | 
			
		||||
		baseKey := x1.highlowcontainer.getKeyAtIndex(basePos)
 | 
			
		||||
 | 
			
		||||
		// accumulate containers for current key, find next minimal key in filters
 | 
			
		||||
		// and exclude filters that do not have related values anymore
 | 
			
		||||
		i := 0
 | 
			
		||||
		maxPossibleOr := 0
 | 
			
		||||
		minNextKey = MaxUint16
 | 
			
		||||
		for _, f := range filters {
 | 
			
		||||
			if f.key < baseKey {
 | 
			
		||||
				f.pos = f.bitmap.advanceUntil(baseKey, f.pos)
 | 
			
		||||
				if f.pos == f.bitmap.size() {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
				f.key = f.bitmap.getKeyAtIndex(f.pos)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			if f.key == baseKey {
 | 
			
		||||
				cont := f.bitmap.getContainerAtIndex(f.pos)
 | 
			
		||||
				keyContainers = append(keyContainers, cont)
 | 
			
		||||
				maxPossibleOr += cont.getCardinality()
 | 
			
		||||
 | 
			
		||||
				f.pos++
 | 
			
		||||
				if f.pos == f.bitmap.size() {
 | 
			
		||||
					continue
 | 
			
		||||
				}
 | 
			
		||||
				f.key = f.bitmap.getKeyAtIndex(f.pos)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			minNextKey = minOfUint16(minNextKey, f.key)
 | 
			
		||||
			filters[i] = f
 | 
			
		||||
			i++
 | 
			
		||||
		}
 | 
			
		||||
		filters = filters[:i]
 | 
			
		||||
 | 
			
		||||
		if len(keyContainers) == 0 {
 | 
			
		||||
			basePos = x1.highlowcontainer.advanceUntil(minNextKey, basePos)
 | 
			
		||||
			continue
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		var ored container
 | 
			
		||||
 | 
			
		||||
		if len(keyContainers) == 1 {
 | 
			
		||||
			ored = keyContainers[0]
 | 
			
		||||
		} else {
 | 
			
		||||
			//TODO: special case for run containers?
 | 
			
		||||
			if maxPossibleOr > arrayDefaultMaxSize {
 | 
			
		||||
				if tmpBitmap == nil {
 | 
			
		||||
					tmpBitmap = newBitmapContainer()
 | 
			
		||||
				}
 | 
			
		||||
				tmpBitmap.resetTo(keyContainers[0])
 | 
			
		||||
				for _, c := range keyContainers[1:] {
 | 
			
		||||
					tmpBitmap.ior(c)
 | 
			
		||||
				}
 | 
			
		||||
				ored = tmpBitmap
 | 
			
		||||
			} else {
 | 
			
		||||
				if tmpArray == nil {
 | 
			
		||||
					tmpArray = newArrayContainerCapacity(maxPossibleOr)
 | 
			
		||||
				}
 | 
			
		||||
				tmpArray.realloc(maxPossibleOr)
 | 
			
		||||
				tmpArray.resetTo(keyContainers[0])
 | 
			
		||||
				for _, c := range keyContainers[1:] {
 | 
			
		||||
					tmpArray.ior(c)
 | 
			
		||||
				}
 | 
			
		||||
				ored = tmpArray
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		result := x1.highlowcontainer.getWritableContainerAtIndex(basePos).iand(ored)
 | 
			
		||||
		if result.getCardinality() > 0 {
 | 
			
		||||
			x1.highlowcontainer.replaceKeyAndContainerAtIndex(intersections, baseKey, result, false)
 | 
			
		||||
			intersections++
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		keyContainers = keyContainers[:0]
 | 
			
		||||
		basePos = x1.highlowcontainer.advanceUntil(minNextKey, basePos)
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	x1.highlowcontainer.resize(intersections)
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										14
									
								
								vendor/github.com/RoaringBitmap/roaring/manyiterator.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										14
									
								
								vendor/github.com/RoaringBitmap/roaring/manyiterator.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -2,6 +2,7 @@ package roaring
 | 
			
		|||
 | 
			
		||||
type manyIterable interface {
 | 
			
		||||
	nextMany(hs uint32, buf []uint32) int
 | 
			
		||||
	nextMany64(hs uint64, buf []uint64) int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (si *shortIterator) nextMany(hs uint32, buf []uint32) int {
 | 
			
		||||
| 
						 | 
				
			
			@ -16,3 +17,16 @@ func (si *shortIterator) nextMany(hs uint32, buf []uint32) int {
 | 
			
		|||
	si.loc = l
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (si *shortIterator) nextMany64(hs uint64, buf []uint64) int {
 | 
			
		||||
	n := 0
 | 
			
		||||
	l := si.loc
 | 
			
		||||
	s := si.slice
 | 
			
		||||
	for n < len(buf) && l < len(s) {
 | 
			
		||||
		buf[n] = uint64(s[l]) | hs
 | 
			
		||||
		l++
 | 
			
		||||
		n++
 | 
			
		||||
	}
 | 
			
		||||
	si.loc = l
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										36
									
								
								vendor/github.com/RoaringBitmap/roaring/roaring.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										36
									
								
								vendor/github.com/RoaringBitmap/roaring/roaring.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -346,7 +346,9 @@ func newIntReverseIterator(a *Bitmap) *intReverseIterator {
 | 
			
		|||
// ManyIntIterable allows you to iterate over the values in a Bitmap
 | 
			
		||||
type ManyIntIterable interface {
 | 
			
		||||
	// pass in a buffer to fill up with values, returns how many values were returned
 | 
			
		||||
	NextMany([]uint32) int
 | 
			
		||||
	NextMany(buf []uint32) int
 | 
			
		||||
	// pass in a buffer to fill up with 64 bit values, returns how many values were returned
 | 
			
		||||
	NextMany64(hs uint64, buf []uint64) int
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
type manyIntIterator struct {
 | 
			
		||||
| 
						 | 
				
			
			@ -382,6 +384,25 @@ func (ii *manyIntIterator) NextMany(buf []uint32) int {
 | 
			
		|||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ii *manyIntIterator) NextMany64(hs64 uint64, buf []uint64) int {
 | 
			
		||||
	n := 0
 | 
			
		||||
	for n < len(buf) {
 | 
			
		||||
		if ii.iter == nil {
 | 
			
		||||
			break
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		hs := uint64(ii.hs) | hs64
 | 
			
		||||
		moreN := ii.iter.nextMany64(hs, buf[n:])
 | 
			
		||||
		n += moreN
 | 
			
		||||
		if moreN == 0 {
 | 
			
		||||
			ii.pos = ii.pos + 1
 | 
			
		||||
			ii.init()
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func newManyIntIterator(a *Bitmap) *manyIntIterator {
 | 
			
		||||
	p := new(manyIntIterator)
 | 
			
		||||
	p.pos = 0
 | 
			
		||||
| 
						 | 
				
			
			@ -678,7 +699,10 @@ func (rb *Bitmap) GetCardinality() uint64 {
 | 
			
		|||
	return size
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality())
 | 
			
		||||
// Rank returns the number of integers that are smaller or equal to x (Rank(infinity) would be GetCardinality()).
 | 
			
		||||
// If you pass the smallest value, you get the value 1. If you pass a value that is smaller than the smallest
 | 
			
		||||
// value, you get 0. Note that this function differs in convention from the Select function since it
 | 
			
		||||
// return 1 and not 0 on the smallest value.
 | 
			
		||||
func (rb *Bitmap) Rank(x uint32) uint64 {
 | 
			
		||||
	size := uint64(0)
 | 
			
		||||
	for i := 0; i < rb.highlowcontainer.size(); i++ {
 | 
			
		||||
| 
						 | 
				
			
			@ -695,7 +719,9 @@ func (rb *Bitmap) Rank(x uint32) uint64 {
 | 
			
		|||
	return size
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// Select returns the xth integer in the bitmap
 | 
			
		||||
// Select returns the xth integer in the bitmap. If you pass 0, you get
 | 
			
		||||
// the smallest element. Note that this function differs in convention from
 | 
			
		||||
// the Rank function which returns 1 on the smallest value.
 | 
			
		||||
func (rb *Bitmap) Select(x uint32) (uint32, error) {
 | 
			
		||||
	if rb.GetCardinality() <= uint64(x) {
 | 
			
		||||
		return 0, fmt.Errorf("can't find %dth integer in a bitmap with only %d items", x, rb.GetCardinality())
 | 
			
		||||
| 
						 | 
				
			
			@ -1555,3 +1581,7 @@ func (rb *Bitmap) Stats() Statistics {
 | 
			
		|||
	}
 | 
			
		||||
	return stats
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (rb *Bitmap) FillLeastSignificant32bits(x []uint64, i uint64, mask uint64) {
 | 
			
		||||
	rb.ManyIterator().NextMany64(mask, x[i:])
 | 
			
		||||
}
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										4
									
								
								vendor/github.com/RoaringBitmap/roaring/roaringarray.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										4
									
								
								vendor/github.com/RoaringBitmap/roaring/roaringarray.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -491,11 +491,11 @@ func (ra *roaringArray) writeTo(w io.Writer) (n int64, err error) {
 | 
			
		|||
		binary.LittleEndian.PutUint16(buf[2:], uint16(len(ra.keys)-1))
 | 
			
		||||
		nw += 2
 | 
			
		||||
		// compute isRun bitmap without temporary allocation
 | 
			
		||||
		var runbitmapslice = buf[nw:nw+isRunSizeInBytes]
 | 
			
		||||
		var runbitmapslice = buf[nw : nw+isRunSizeInBytes]
 | 
			
		||||
		for i, c := range ra.containers {
 | 
			
		||||
			switch c.(type) {
 | 
			
		||||
			case *runContainer16:
 | 
			
		||||
				runbitmapslice[i / 8] |= 1<<(uint(i)%8)
 | 
			
		||||
				runbitmapslice[i/8] |= 1 << (uint(i) % 8)
 | 
			
		||||
			}
 | 
			
		||||
		}
 | 
			
		||||
		nw += isRunSizeInBytes
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										41
									
								
								vendor/github.com/RoaringBitmap/roaring/runcontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										41
									
								
								vendor/github.com/RoaringBitmap/roaring/runcontainer.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1321,6 +1321,47 @@ func (ri *runIterator16) nextMany(hs uint32, buf []uint32) int {
 | 
			
		|||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func (ri *runIterator16) nextMany64(hs uint64, buf []uint64) int {
 | 
			
		||||
	n := 0
 | 
			
		||||
 | 
			
		||||
	if !ri.hasNext() {
 | 
			
		||||
		return n
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	// start and end are inclusive
 | 
			
		||||
	for n < len(buf) {
 | 
			
		||||
		moreVals := 0
 | 
			
		||||
 | 
			
		||||
		if ri.rc.iv[ri.curIndex].length >= ri.curPosInIndex {
 | 
			
		||||
			// add as many as you can from this seq
 | 
			
		||||
			moreVals = minOfInt(int(ri.rc.iv[ri.curIndex].length-ri.curPosInIndex)+1, len(buf)-n)
 | 
			
		||||
			base := uint64(ri.rc.iv[ri.curIndex].start+ri.curPosInIndex) | hs
 | 
			
		||||
 | 
			
		||||
			// allows BCE
 | 
			
		||||
			buf2 := buf[n : n+moreVals]
 | 
			
		||||
			for i := range buf2 {
 | 
			
		||||
				buf2[i] = base + uint64(i)
 | 
			
		||||
			}
 | 
			
		||||
 | 
			
		||||
			// update values
 | 
			
		||||
			n += moreVals
 | 
			
		||||
		}
 | 
			
		||||
 | 
			
		||||
		if moreVals+int(ri.curPosInIndex) > int(ri.rc.iv[ri.curIndex].length) {
 | 
			
		||||
			ri.curPosInIndex = 0
 | 
			
		||||
			ri.curIndex++
 | 
			
		||||
 | 
			
		||||
			if ri.curIndex == int64(len(ri.rc.iv)) {
 | 
			
		||||
				break
 | 
			
		||||
			}
 | 
			
		||||
		} else {
 | 
			
		||||
			ri.curPosInIndex += uint16(moreVals) //moreVals always fits in uint16
 | 
			
		||||
		}
 | 
			
		||||
	}
 | 
			
		||||
 | 
			
		||||
	return n
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// remove removes key from the container.
 | 
			
		||||
func (rc *runContainer16) removeKey(key uint16) (wasPresent bool) {
 | 
			
		||||
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
							
								
								
									
										5
									
								
								vendor/github.com/RoaringBitmap/roaring/util.go
									
										
									
										generated
									
									
										vendored
									
									
								
							
							
						
						
									
										5
									
								
								vendor/github.com/RoaringBitmap/roaring/util.go
									
										
									
										generated
									
									
										vendored
									
									
								
							| 
						 | 
				
			
			@ -1,6 +1,7 @@
 | 
			
		|||
package roaring
 | 
			
		||||
 | 
			
		||||
import (
 | 
			
		||||
	"math"
 | 
			
		||||
	"math/rand"
 | 
			
		||||
	"sort"
 | 
			
		||||
)
 | 
			
		||||
| 
						 | 
				
			
			@ -15,7 +16,7 @@ const (
 | 
			
		|||
	noOffsetThreshold          = 4
 | 
			
		||||
 | 
			
		||||
	// MaxUint32 is the largest uint32 value.
 | 
			
		||||
	MaxUint32 = 4294967295
 | 
			
		||||
	MaxUint32 = math.MaxUint32
 | 
			
		||||
 | 
			
		||||
	// MaxRange is One more than the maximum allowed bitmap bit index. For use as an upper
 | 
			
		||||
	// bound for ranges.
 | 
			
		||||
| 
						 | 
				
			
			@ -23,7 +24,7 @@ const (
 | 
			
		|||
 | 
			
		||||
	// MaxUint16 is the largest 16 bit unsigned int.
 | 
			
		||||
	// This is the largest value an interval16 can store.
 | 
			
		||||
	MaxUint16 = 65535
 | 
			
		||||
	MaxUint16 = math.MaxUint16
 | 
			
		||||
 | 
			
		||||
	// Compute wordSizeInBytes, the size of a word in bytes.
 | 
			
		||||
	_m              = ^uint64(0)
 | 
			
		||||
| 
						 | 
				
			
			
 | 
			
		|||
		Loading…
	
	Add table
		Add a link
		
	
		Reference in a new issue