bitset

package
v0.9.0 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Aug 10, 2025 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package set provides bit-based set implementations for efficient storage and manipulation of collections of elements.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type BitBool

type BitBool []bool

BitBool is a bit set implementation backed by a slice of bool values. It can dynamically grow to accommodate new elements.

func (BitBool) Has

func (b BitBool) Has(i int) bool

Has checks if the bit at position i is set. Returns false for any position beyond the current length.

func (BitBool) Len

func (b BitBool) Len() int

Len returns the total number of bits in the set.

func (*BitBool) Set

func (b *BitBool) Set(i int, t bool)

Set sets or clears the bit at position i.

type BitUint8

type BitUint8 []uint8

BitUint8 is a bit set implementation backed by a slice of uint8 values.

func NewBitUint8

func NewBitUint8(n int) BitUint8

NewBitUint8 creates a new BitUint8 with capacity for at least n bits.

func (BitUint8) Has

func (b BitUint8) Has(n int) bool

Has checks if the bit at position n is set.

func (BitUint8) Len

func (b BitUint8) Len() int

Len returns the total number of bits in the set.

func (*BitUint8) ReadFrom

func (b *BitUint8) ReadFrom(r io.Reader) (n int64, err error)

ReadFrom implements io.ReaderFrom.

func (BitUint8) Set

func (b BitUint8) Set(n int, t bool)

Set sets or clears the bit at position n.

func (BitUint8) WriteTo

func (b BitUint8) WriteTo(w io.Writer) (n int64, err error)

WriteTo implements io.WriterTo.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL