This commit is contained in:
@@ -3,6 +3,13 @@ package bitset32
|
|||||||
import "math/bits"
|
import "math/bits"
|
||||||
|
|
||||||
func popcntSlice(s []uint32) uint64 {
|
func popcntSlice(s []uint32) uint64 {
|
||||||
|
|
||||||
|
// int r = 0;
|
||||||
|
// while(n)
|
||||||
|
// {
|
||||||
|
// n &= (n - 1);
|
||||||
|
// ++r;
|
||||||
|
// }
|
||||||
var cnt int
|
var cnt int
|
||||||
for _, x := range s {
|
for _, x := range s {
|
||||||
cnt += bits.OnesCount32(x)
|
cnt += bits.OnesCount32(x)
|
||||||
|
|||||||
Reference in New Issue
Block a user