update vendor
This commit is contained in:
parent
824f46979b
commit
8675bc4b7a
328 changed files with 27166 additions and 6537 deletions
61
vendor/github.com/bits-and-blooms/bitset/popcnt.go
generated
vendored
61
vendor/github.com/bits-and-blooms/bitset/popcnt.go
generated
vendored
|
|
@ -1,53 +1,52 @@
|
|||
package bitset
|
||||
|
||||
// bit population count, take from
|
||||
// https://code.google.com/p/go/issues/detail?id=4988#c11
|
||||
// credit: https://code.google.com/u/arnehormann/
|
||||
func popcount(x uint64) (n uint64) {
|
||||
x -= (x >> 1) & 0x5555555555555555
|
||||
x = (x>>2)&0x3333333333333333 + x&0x3333333333333333
|
||||
x += x >> 4
|
||||
x &= 0x0f0f0f0f0f0f0f0f
|
||||
x *= 0x0101010101010101
|
||||
return x >> 56
|
||||
}
|
||||
import "math/bits"
|
||||
|
||||
func popcntSliceGo(s []uint64) uint64 {
|
||||
cnt := uint64(0)
|
||||
func popcntSlice(s []uint64) (cnt uint64) {
|
||||
for _, x := range s {
|
||||
cnt += popcount(x)
|
||||
cnt += uint64(bits.OnesCount64(x))
|
||||
}
|
||||
return cnt
|
||||
return
|
||||
}
|
||||
|
||||
func popcntMaskSliceGo(s, m []uint64) uint64 {
|
||||
cnt := uint64(0)
|
||||
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 += popcount(s[i] &^ m[i])
|
||||
cnt += uint64(bits.OnesCount64(s[i] &^ m[i]))
|
||||
}
|
||||
return cnt
|
||||
return
|
||||
}
|
||||
|
||||
func popcntAndSliceGo(s, m []uint64) uint64 {
|
||||
cnt := uint64(0)
|
||||
// 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 += popcount(s[i] & m[i])
|
||||
cnt += uint64(bits.OnesCount64(s[i] & m[i]))
|
||||
}
|
||||
return cnt
|
||||
return
|
||||
}
|
||||
|
||||
func popcntOrSliceGo(s, m []uint64) uint64 {
|
||||
cnt := uint64(0)
|
||||
// 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 += popcount(s[i] | m[i])
|
||||
cnt += uint64(bits.OnesCount64(s[i] | m[i]))
|
||||
}
|
||||
return cnt
|
||||
return
|
||||
}
|
||||
|
||||
func popcntXorSliceGo(s, m []uint64) uint64 {
|
||||
cnt := uint64(0)
|
||||
// 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 += popcount(s[i] ^ m[i])
|
||||
cnt += uint64(bits.OnesCount64(s[i] ^ m[i]))
|
||||
}
|
||||
return cnt
|
||||
return
|
||||
}
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue