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

Method ClearBit

bitarray/sparse_bitarray.go:169–183  ·  view source on GitHub ↗

ClearBit clears the bit at the given position.

(k uint64)

Source from the content-addressed store, hash-verified

167
168// ClearBit clears the bit at the given position.
169func (sba *sparseBitArray) ClearBit(k uint64) error {
170 index, position := getIndexAndRemainder(k)
171 i := sba.indices.get(index)
172 if i == -1 {
173 return nil
174 }
175
176 sba.blocks[i] = sba.blocks[i].remove(position)
177 if sba.blocks[i] == 0 {
178 sba.blocks.deleteAtIndex(i)
179 sba.indices.deleteAtIndex(i)
180 }
181
182 return nil
183}
184
185// Reset erases all values from this bitarray.
186func (sba *sparseBitArray) Reset() {

Callers

nothing calls this directly

Calls 4

getIndexAndRemainderFunction · 0.85
getMethod · 0.45
removeMethod · 0.45
deleteAtIndexMethod · 0.45

Tested by

no test coverage detected