MCPcopy Index your code
hub / github.com/Workiva/go-datastructures / GetBit

Method GetBit

bitarray/bitarray.go:111–119  ·  view source on GitHub ↗

GetBit returns a bool indicating if the value at the given index has been set.

(k uint64)

Source from the content-addressed store, hash-verified

109// GetBit returns a bool indicating if the value at the given
110// index has been set.
111func (ba *bitArray) GetBit(k uint64) (bool, error) {
112 if k >= ba.Capacity() {
113 return false, OutOfRangeError(k)
114 }
115
116 i, pos := getIndexAndRemainder(k)
117 result := ba.blocks[i]&block(1<<pos) != 0
118 return result, nil
119}
120
121// GetSetBits gets the position of bits set in the array.
122func (ba *bitArray) GetSetBits(from uint64, buffer []uint64) []uint64 {

Callers

nothing calls this directly

Calls 4

CapacityMethod · 0.95
OutOfRangeErrorTypeAlias · 0.85
getIndexAndRemainderFunction · 0.85
blockTypeAlias · 0.85

Tested by

no test coverage detected