bitsets

package module
v0.0.0-...-f98563f Latest Latest
Warning

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

Go to latest
Published: Nov 4, 2025 License: MIT Imports: 0 Imported by: 0

README

bitsets

PkgGoDev GoReportCard

Description

This small package provides bitset types for Go, leaning on math/bits under the hood. Example use cases might be marking certain indices of a small slice, or keeping a selection of values from an enumeration.

There are a few similar other packages out there, this particular one has the following feature set:

  • Friendly to stack allocation, zero value is good to go
  • Separate types for fixed-width versions of capacity 8, 16, 32, 64, 128 (bit8 through bit128), 1024 and 8192 (kbit and kbit8), plus a variable-width one (vbit)
  • Fluent methods for usual logic operations (Not, And, Or, etc), each with a self-assigning version (AssignNot, AssignAnd, AssignOr, etc)
  • Loop over the values (or contiguous sub-ranges) with range-func
  • No dependencies

The various types provide a similar interface, so you can swap between with relative ease if needs change.

License

MIT

Documentation

The Go Gopher

There is no documentation for this package.

Directories

Path Synopsis
internal
cmd/gen command

Jump to

Keyboard shortcuts

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