mathutil

package
v0.35.1 Latest Latest
Warning

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

Go to latest
Published: Jan 2, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func FloorDiv

func FloorDiv(a, b int) int

FloorDiv returns the floor of the quotient of a/b.

Types

type BitSet

type BitSet struct {
	// The underlying byte slice that holds the bits.
	Bytes []byte
}

BitSet represents a set of Bytes that can be set and cleared.

func NewBitSet

func NewBitSet(length int) *BitSet

NewBitSet creates a new BitSet with the given length.

func (*BitSet) Clear

func (b *BitSet) Clear(index int)

Clear sets the bit at the given index to 0. If the index is greater than the current length of the BitSet, the BitSet is automatically grown to accommodate the new index.

func (*BitSet) Empty

func (b *BitSet) Empty() bool

Empty returns true if this BitSet contains no Bytes that are set to true.

func (*BitSet) Set

func (b *BitSet) Set(index int)

Set sets the bit at the given index to 1. If the index is greater than the current length of the BitSet, the BitSet is automatically grown to accommodate the new index.

func (*BitSet) SetBool

func (b *BitSet) SetBool(index int, value bool)

SetBool sets the bit at the given index to the given value. If the index is greater than the current length of the BitSet, the BitSet is automatically grown to accommodate the new index.

func (*BitSet) String

func (b *BitSet) String() string

String returns a string representation of the BitSet.

func (*BitSet) Test

func (b *BitSet) Test(index int) bool

Test returns the value of the bit at the given index. If the index is greater than the current length of the BitSet, false is returned.

Jump to

Keyboard shortcuts

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