mirror of
https://github.com/opencloud-eu/opencloud.git
synced 2026-07-19 20:14:17 -04:00
Bumps [github.com/blevesearch/bleve/v2](https://github.com/blevesearch/bleve) from 2.5.7 to 2.6.0. - [Release notes](https://github.com/blevesearch/bleve/releases) - [Commits](https://github.com/blevesearch/bleve/compare/v2.5.7...v2.6.0) --- updated-dependencies: - dependency-name: github.com/blevesearch/bleve/v2 dependency-version: 2.6.0 dependency-type: direct:production update-type: version-update:semver-minor ... Signed-off-by: dependabot[bot] <support@github.com>
53 lines
1.3 KiB
Go
53 lines
1.3 KiB
Go
package bitset
|
|
|
|
import "math/bits"
|
|
|
|
func popcntSlice(s []uint64) (cnt uint64) {
|
|
for _, x := range s {
|
|
cnt += uint64(bits.OnesCount64(x))
|
|
}
|
|
return
|
|
}
|
|
|
|
func popcntMaskSlice(s, m []uint64) (cnt uint64) {
|
|
// The next line is to help the bounds checker, it matters!
|
|
_ = m[len(s)-1] // BCE
|
|
for i := range s {
|
|
cnt += uint64(bits.OnesCount64(s[i] &^ m[i]))
|
|
}
|
|
return
|
|
}
|
|
|
|
// popcntAndSlice computes the population count of the AND of two slices.
|
|
// It assumes that len(m) >= len(s) > 0.
|
|
func popcntAndSlice(s, m []uint64) (cnt uint64) {
|
|
// The next line is to help the bounds checker, it matters!
|
|
_ = m[len(s)-1] // BCE
|
|
for i := range s {
|
|
cnt += uint64(bits.OnesCount64(s[i] & m[i]))
|
|
}
|
|
return
|
|
}
|
|
|
|
// popcntOrSlice computes the population count of the OR of two slices.
|
|
// It assumes that len(m) >= len(s) > 0.
|
|
func popcntOrSlice(s, m []uint64) (cnt uint64) {
|
|
// The next line is to help the bounds checker, it matters!
|
|
_ = m[len(s)-1] // BCE
|
|
for i := range s {
|
|
cnt += uint64(bits.OnesCount64(s[i] | m[i]))
|
|
}
|
|
return
|
|
}
|
|
|
|
// popcntXorSlice computes the population count of the XOR of two slices.
|
|
// It assumes that len(m) >= len(s) > 0.
|
|
func popcntXorSlice(s, m []uint64) (cnt uint64) {
|
|
// The next line is to help the bounds checker, it matters!
|
|
_ = m[len(s)-1] // BCE
|
|
for i := range s {
|
|
cnt += uint64(bits.OnesCount64(s[i] ^ m[i]))
|
|
}
|
|
return
|
|
}
|