package bitmap
import "github.com/docker/docker/libnetwork/bitmap"
Package bitmap provides a datatype for long vectors of bits.
Index ¶
- Variables
- type Bitmap
- func Copy(b *Bitmap) *Bitmap
- func New(n uint64) *Bitmap
- func (h *Bitmap) Bits() uint64
- func (h *Bitmap) IsSet(ordinal uint64) bool
- func (h *Bitmap) MarshalBinary() ([]byte, error)
- func (h *Bitmap) MarshalJSON() ([]byte, error)
- func (h *Bitmap) Set(ordinal uint64) error
- func (h *Bitmap) SetAny(serial bool) (uint64, error)
- func (h *Bitmap) SetAnyInRange(start, end uint64, serial bool) (uint64, error)
- func (h *Bitmap) String() string
- func (h *Bitmap) UnmarshalBinary(ba []byte) error
- func (h *Bitmap) UnmarshalJSON(data []byte) error
- func (h *Bitmap) Unselected() uint64
- func (h *Bitmap) Unset(ordinal uint64) error
Variables ¶
var ( // ErrNoBitAvailable is returned when no more bits are available to set ErrNoBitAvailable = errors.New("no bit available") // ErrBitAllocated is returned when the specific bit requested is already set ErrBitAllocated = errors.New("requested bit is already allocated") )
Types ¶
type Bitmap ¶
type Bitmap struct {
// contains filtered or unexported fields
}
Bitmap is a fixed-length bit vector. It is not safe for concurrent use.
The data is stored as a list of run-length encoded blocks. It operates directly on the encoded representation, without decompressing.
func Copy ¶
Copy returns a deep copy of b.
func New ¶
NewHandle returns a new Bitmap of ordinals in the interval [0, n).
func (*Bitmap) Bits ¶
Bits returns the length of the bit sequence
func (*Bitmap) IsSet ¶
IsSet atomically checks if the ordinal bit is set. In case ordinal is outside of the bit sequence limits, false is returned.
func (*Bitmap) MarshalBinary ¶
MarshalBinary encodes h into a binary representation.
func (*Bitmap) MarshalJSON ¶
MarshalJSON encodes h into a JSON message
func (*Bitmap) Set ¶
Set atomically sets the corresponding bit in the sequence
func (*Bitmap) SetAny ¶
SetAny sets the first unset bit in the sequence and returns the ordinal of the set bit.
When serial=true, the bitmap is scanned starting from the ordinal following the bit most recently set by Bitmap.SetAny or Bitmap.SetAnyInRange.
func (*Bitmap) SetAnyInRange ¶
SetAnyInRange sets the first unset bit in the range [start, end] and returns the ordinal of the set bit.
When serial=true, the bitmap is scanned starting from the ordinal following the bit most recently set by Bitmap.SetAny or Bitmap.SetAnyInRange.
func (*Bitmap) String ¶
func (*Bitmap) UnmarshalBinary ¶
UnmarshalBinary decodes a binary representation of a Bitmap value which was generated using Bitmap.MarshalBinary.
The scan position for serial Bitmap.SetAny and Bitmap.SetAnyInRange operations is neither unmarshaled nor reset.
func (*Bitmap) UnmarshalJSON ¶
UnmarshalJSON decodes JSON message into h
func (*Bitmap) Unselected ¶
Unselected returns the number of bits which are not selected
func (*Bitmap) Unset ¶
Unset atomically unsets the corresponding bit in the sequence
Source Files ¶
- Version
- v27.2.1+incompatible
- Published
- Sep 6, 2024
- Platform
- js/wasm
- Imports
- 4 packages
- Last checked
- 20 minutes ago –
Tools for package owners.