bitset

package module
v0.0.0-...-6a307ac Latest Latest
Warning

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

Go to latest
Published: Dec 8, 2022 License: GPL-3.0 Imports: 1 Imported by: 0

README

bitset

This is a simple implementation of a bitset.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Binary

type Binary[V Value, S Bitset[V]] interface {
	And(b S) (aAndB S) // self
	Or(b S) (aOrB S)   // self
}

Binary are chainable binary operations over bitsets of the same type. these functions are not expected to modify A or B, and S is also meant to conform to Binary[V, S Bitset[V]]

type Bitset

type Bitset[V Value] interface {
	Get(index V) bool

	Set(indices ...V)
	Unset(indices ...V)

	Clear()
}

Basic functionality of a bitset implementation

type Inspect

type Inspect[V Value] interface {
	Size
	Pop() uint
}

Population count & size. TODO: move 'Pop' to Bitset proper?

type Size

type Size interface {
	// int and not uint for consistency's sake :(
	Len() int
	Cap() int
}

Size-related inspection referring to the underlying bitset data storage

type Value

type Value interface {
	constraints.Unsigned |
		~rune // this is int32, but no runes are actually negative.
}

Directories

Path Synopsis
dense
mixin
sparse
map

Jump to

Keyboard shortcuts

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