Source File
popcnt.go
Belonging Package
github.com/bits-and-blooms/bitset
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( uint64) ( uint64) {-= ( >> 1) & 0x5555555555555555= (>>2)&0x3333333333333333 + &0x3333333333333333+= >> 4&= 0x0f0f0f0f0f0f0f0f*= 0x0101010101010101return >> 56}func popcntSliceGo( []uint64) uint64 {:= uint64(0)for , := range {+= popcount()}return}func popcntMaskSliceGo(, []uint64) uint64 {:= uint64(0)for := range {+= popcount([] &^ [])}return}func popcntAndSliceGo(, []uint64) uint64 {:= uint64(0)for := range {+= popcount([] & [])}return}func popcntOrSliceGo(, []uint64) uint64 {:= uint64(0)for := range {+= popcount([] | [])}return}func popcntXorSliceGo(, []uint64) uint64 {:= uint64(0)for := range {+= popcount([] ^ [])}return}
![]() |
The pages are generated with Golds v0.8.2. (GOOS=linux GOARCH=amd64) Golds is a Go 101 project developed by Tapir Liu. PR and bug reports are welcome and can be submitted to the issue list. Please follow @zigo_101 (reachable from the left QR code) to get the latest news of Golds. |