package bitmap
import "gvisor.dev/gvisor/pkg/bitmap"
Package bitmap provides the implementation of bitmap.
Index ¶
- Constants
- type Bitmap
- func New(size uint32) Bitmap
- func (b *Bitmap) Add(i uint32)
- func (b *Bitmap) ClearRange(begin, end uint32)
- func (b *Bitmap) Clone() Bitmap
- func (b *Bitmap) FirstOne(start uint32) (bit uint32, err error)
- func (b *Bitmap) FirstZero(start uint32) (bit uint32, err error)
- func (b *Bitmap) FlipRange(begin, end uint32)
- func (b *Bitmap) ForEach(start, end uint32, f func(idx uint32) bool)
- func (b *Bitmap) GetNumOnes() uint32
- func (b *Bitmap) Grow(toGrow uint32) error
- func (b *Bitmap) IsEmpty() bool
- func (b *Bitmap) Maximum() uint32
- func (b *Bitmap) Minimum() uint32
- func (b *Bitmap) Remove(i uint32)
- func (b *Bitmap) Reset()
- func (b *Bitmap) Size() int
- func (b *Bitmap) ToSlice() []uint32
Constants ¶
MaxBitEntryLimit defines the upper limit on how many bit entries are supported by this Bitmap implementation.
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap implements an efficient bitmap.
+stateify savable
func New ¶
New create a new empty Bitmap.
func (*Bitmap) Add ¶
Add add i to the Bitmap.
func (*Bitmap) ClearRange ¶
ClearRange clear bits within range (begin and end) for the Bitmap. begin is inclusive and end is exclusive.
func (*Bitmap) Clone ¶
Clone the Bitmap.
func (*Bitmap) FirstOne ¶
FirstOne returns the first set bit from the range [start, )
func (*Bitmap) FirstZero ¶
FirstZero returns the first unset bit from the range [start, ).
func (*Bitmap) FlipRange ¶
FlipRange flip bits within range (begin and end) for the Bitmap. begin is inclusive and end is exclusive.
func (*Bitmap) ForEach ¶
ForEach calls `f` for each set bit in the range [start, end).
If f returns false, ForEach stops the iteration.
func (*Bitmap) GetNumOnes ¶
GetNumOnes return the number of ones in the Bitmap.
func (*Bitmap) Grow ¶
Grow grows the bitmap by at least toGrow bits.
func (*Bitmap) IsEmpty ¶
IsEmpty verifies whether the Bitmap is empty.
func (*Bitmap) Maximum ¶
Maximum return the largest value in the Bitmap.
func (*Bitmap) Minimum ¶
Minimum return the smallest value in the Bitmap.
func (*Bitmap) Remove ¶
Remove i from the Bitmap.
func (*Bitmap) Reset ¶
func (b *Bitmap) Reset()
Reset zeroes the entire bitmap.
func (*Bitmap) Size ¶
Size returns the total number of bits in the bitmap.
func (*Bitmap) ToSlice ¶
ToSlice transform the Bitmap into slice. For example, a bitmap of [0, 1, 0, 1] will return the slice [1, 3].
Source Files ¶
bitmap.go
- Version
- v0.0.0-20250605235530-a6711d1e1dc6 (latest)
- Published
- Jun 5, 2025
- Platform
- linux/amd64
- Imports
- 3 packages
- Last checked
- 4 hours ago –
Tools for package owners.