bitvector

package
v0.0.0-...-cbd5ca3 Latest Latest
Warning

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

Go to latest
Published: May 25, 2023 License: MIT Imports: 2 Imported by: 0

Documentation

Overview

Package bitvector contains types and methods for working with bit vectors

Index

Constants

View Source
const MAX_INT = int(MAX_UINT >> 1)

MAX_INT

View Source
const MAX_UINT = ^uint(0)

MAX_UINT

Variables

View Source
var MAX_SIZE = maxSize()

MAX_SIZE is calculated at compile time

View Source
var PC64 = pc64()

PC64 is used to determine population count, e.g. PC64[i] is the population count of i

Functions

This section is empty.

Types

type BitVector

type BitVector []int

BitVector is the base type

func NewBitVector

func NewBitVector(maxValue int) BitVector

NewBitVector is the constructor Given the maximum value to hold in the bit vector, return an int array sized to do so

func (BitVector) Add

func (BitVector BitVector) Add(k int) error

Add is a method to add an integer to the bit vector

func (BitVector) BWAND

func (BitVector BitVector) BWAND(bv2 BitVector) (BitVector, error)

BWAND is a method to return the bitwise AND of two BitVectors.

func (BitVector) Contains

func (BitVector BitVector) Contains(k int) bool

Contains is a method to check a bit vector for a value

func (BitVector) Delete

func (BitVector BitVector) Delete(k int)

Delete is a method to delete a value from a bit vector

func (BitVector) MaxOut

func (BitVector BitVector) MaxOut()

MaxOut is a method to flip all the bits in the bit vector to 1

func (BitVector) PopCount

func (BitVector BitVector) PopCount() int

PopCount is a method to report the number of flipped bits in the bit vector (using the population count algorithm)

func (BitVector) WipeOut

func (BitVector BitVector) WipeOut()

WipeOut is a method to flip all the bits in the bit vector to 0

Jump to

Keyboard shortcuts

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