diff --git a/utils/bitmap.go b/utils/bitmap.go index 503b9021..3ab5e37d 100644 --- a/utils/bitmap.go +++ b/utils/bitmap.go @@ -22,14 +22,11 @@ type bitmapNumber interface { type Bitmap[T bitmapNumber] struct { bits []uint64 - cap int } func NewBitmap[T bitmapNumber](size int) *Bitmap[T] { - c := 1 << bits.Len64(uint64(size+63)/64) return &Bitmap[T]{ - bits: make([]uint64, c), - cap: c, + bits: make([]uint64, 1<> 6) // left slot rs = int(max >> 6) // right slot - if rs-ls > b.cap { - rs = ls + b.cap + if rs-ls > len(b.bits) { + rs = ls + len(b.bits) return }