mirror of
https://github.com/ceph/ceph-csi.git
synced 2024-11-14 02:10:21 +00:00
b2099eb3b1
Bumps [k8s.io/kubernetes](https://github.com/kubernetes/kubernetes) from 1.22.3 to 1.22.4. - [Release notes](https://github.com/kubernetes/kubernetes/releases) - [Commits](https://github.com/kubernetes/kubernetes/compare/v1.22.3...v1.22.4) --- updated-dependencies: - dependency-name: k8s.io/kubernetes dependency-type: direct:production update-type: version-update:semver-patch ... Signed-off-by: dependabot[bot] <support@github.com>
54 lines
1020 B
Go
54 lines
1020 B
Go
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
|
|
}
|
|
|
|
func popcntSliceGo(s []uint64) uint64 {
|
|
cnt := uint64(0)
|
|
for _, x := range s {
|
|
cnt += popcount(x)
|
|
}
|
|
return cnt
|
|
}
|
|
|
|
func popcntMaskSliceGo(s, m []uint64) uint64 {
|
|
cnt := uint64(0)
|
|
for i := range s {
|
|
cnt += popcount(s[i] &^ m[i])
|
|
}
|
|
return cnt
|
|
}
|
|
|
|
func popcntAndSliceGo(s, m []uint64) uint64 {
|
|
cnt := uint64(0)
|
|
for i := range s {
|
|
cnt += popcount(s[i] & m[i])
|
|
}
|
|
return cnt
|
|
}
|
|
|
|
func popcntOrSliceGo(s, m []uint64) uint64 {
|
|
cnt := uint64(0)
|
|
for i := range s {
|
|
cnt += popcount(s[i] | m[i])
|
|
}
|
|
return cnt
|
|
}
|
|
|
|
func popcntXorSliceGo(s, m []uint64) uint64 {
|
|
cnt := uint64(0)
|
|
for i := range s {
|
|
cnt += popcount(s[i] ^ m[i])
|
|
}
|
|
return cnt
|
|
}
|