findFirstZero64 returns the index of the first bit at 0, starting from the LSB (least significant bit).
(x uint64)
| 25 | // findFirstZero64 returns the index of the first bit at 0, starting from the |
| 26 | // LSB (least significant bit). |
| 27 | func findFirstZero64(x uint64) (int, bool) { |
| 28 | l := bits.LeadingZeros64(x) |
| 29 | if l != 0 { |
| 30 | return 63, true |
| 31 | } |
| 32 | l = bits.LeadingZeros64(^x) |
| 33 | if l == 64 { |
| 34 | return 0, false |
| 35 | } |
| 36 | return int(63 - l), true |
| 37 | } |
| 38 | |
| 39 | // setBit sets bit i (0-based, starting from LSB) |
| 40 | func (bm *bitmap) setBit(i int) { |
no outgoing calls