bitmask

package
v3.6.7 Latest Latest
Warning

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

Go to latest
Published: Feb 23, 2026 License: AGPL-3.0 Imports: 0 Imported by: 0

Documentation

Overview

Package bitmask provides an API for creating and manipulating bitmasks of arbitrary length.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Mask

type Mask struct {
	// contains filtered or unexported fields
}

Mask is a bitmask of arbitrary length. The zero value is a Mask of length 0.

func New

func New(length int) *Mask

New creates a new Mask with the given length. New panics if length is less than 1.

func (*Mask) Clear

func (m *Mask) Clear(index int)

Clear sets the bit at the given index to 0. Clear panics if index is out of range.

func (*Mask) Len

func (m *Mask) Len() int

Len returns the length of the mask.

func (*Mask) Reset

func (m *Mask) Reset(length int)

Reset zeroes out the mask and resets it to the given length. Reset panics if length is less than 1.

func (*Mask) Set

func (m *Mask) Set(index int)

Set sets the bit at the given index to 1. Set panics if index is out of range.

func (*Mask) Test

func (m *Mask) Test(index int) bool

Test returns true if the bit at the given index is 1. Test panics if index is out of range.

Jump to

Keyboard shortcuts

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