You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@aep It seemed a bit strange to me at first, but if you understand the original use case, it kind makes sense. Here's a function that will range over all the bits if you need it.
// RangeAll iterates over all the bits in the bitmap.
// For the rare instances where bitmap.Range is insufficient
func RangeAll(src bitmap.Bitmap, fn func(k uint32, v bool)) {
l := uint32(len(src))
for blkAt := uint32(0); blkAt < l; blkAt++ {
blk := src[blkAt]
bit := uint64(0x1)
for bitAt := uint32(0); bitAt < 64; bitAt++ {
k := blkAt*64 + bitAt
v := (blk & bit) != 0
fn(k, v)
bit <<= 1
}
}
}
i'm intending to use this as a free-map for a filesystem.
is there a reason there's no range function to find zeros?
am i holding it wrong?
The text was updated successfully, but these errors were encountered: