ClearBit will unset a bit at the given index if it is set.
(k uint64)
| 187 | |
| 188 | // ClearBit will unset a bit at the given index if it is set. |
| 189 | func (ba *bitArray) ClearBit(k uint64) error { |
| 190 | if k >= ba.Capacity() { |
| 191 | return OutOfRangeError(k) |
| 192 | } |
| 193 | |
| 194 | if !ba.anyset { // nothing is set, might as well bail |
| 195 | return nil |
| 196 | } |
| 197 | |
| 198 | i, pos := getIndexAndRemainder(k) |
| 199 | ba.blocks[i] &^= block(1 << pos) |
| 200 | |
| 201 | if k == ba.highest { |
| 202 | ba.setHighest() |
| 203 | } else if k == ba.lowest { |
| 204 | ba.setLowest() |
| 205 | } |
| 206 | return nil |
| 207 | } |
| 208 | |
| 209 | // Count returns the number of set bits in this array. |
| 210 | func (ba *bitArray) Count() int { |
nothing calls this directly
no test coverage detected