MCPcopy Create free account
hub / github.com/distributedio/titan / BitCount

Method BitCount

db/string.go:235–241  ·  view source on GitHub ↗

BitCount counts the number of set bits (population counting) in a string.

(begin, end int)

Source from the content-addressed store, hash-verified

233
234// BitCount counts the number of set bits (population counting) in a string.
235func (s *String) BitCount(begin, end int) (int, error) {
236 begin, end = initCursor(begin, end, len(s.Meta.Value))
237 if begin > end {
238 return 0, nil
239 }
240 return redisPopcount(s.Meta.Value[begin : end+1]), nil
241}
242
243// BitPos finds first bit set or clear in a string
244func (s *String) BitPos(bit, begin, end int) (int, error) {

Callers 2

BitCountFunction · 0.80
TestStringCountBitFunction · 0.80

Calls 2

initCursorFunction · 0.85
redisPopcountFunction · 0.85

Tested by 1

TestStringCountBitFunction · 0.64