(i uint)
| 1184 | } |
| 1185 | |
| 1186 | func (bc *bitmapContainer) NextUnsetBit(i uint) int { |
| 1187 | var ( |
| 1188 | x = i / 64 |
| 1189 | length = uint(len(bc.bitmap)) |
| 1190 | ) |
| 1191 | if x >= length { |
| 1192 | return int(i) |
| 1193 | } |
| 1194 | w := bc.bitmap[x] |
| 1195 | w = w >> (i % 64) |
| 1196 | w = ^w |
| 1197 | if w != 0 { |
| 1198 | return int(i) + countTrailingZeros(w) |
| 1199 | } |
| 1200 | x++ |
| 1201 | for ; x < length; x++ { |
| 1202 | if bc.bitmap[x] != 0xFFFFFFFFFFFFFFFF { |
| 1203 | return int(x*64) + countTrailingZeros(^bc.bitmap[x]) |
| 1204 | } |
| 1205 | } |
| 1206 | return int(length * 64) |
| 1207 | } |
| 1208 | |
| 1209 | // PrevSetBit returns the previous set bit e.g the previous int packed into the bitmaparray |
| 1210 | func (bc *bitmapContainer) PrevSetBit(i int) int { |
no test coverage detected