mirror of
https://codeberg.org/forgejo/forgejo.git
synced 2024-11-14 14:06:15 +01:00
42 lines
669 B
Go
42 lines
669 B
Go
|
package roaring
|
||
|
|
||
|
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
|
||
|
}
|