Documentation ¶
Overview ¶
Package bitmap provides utilities for operating on densely-packed arrays of booleans.
Index ¶
- func BytesFor(bits int) int
- func CountOnes(d Dense) int
- func Dot(x, y Dense) bool
- func Equal(a, b Dense) bool
- func Parity(d Dense) bool
- type Dense
- func And(a, b Dense) Dense
- func DenseFromProto(dba *bb84pb.DenseBitArray) Dense
- func Empty() Dense
- func FromString(s string) (Dense, error)
- func NewDense(data []byte, bitLen int) Dense
- func Not(d Dense) Dense
- func Or(a, b Dense) Dense
- func Select(data, mask Dense) Dense
- func Slice(d Dense, start, end int) (Dense, error)
- func XNor(a, b Dense) Dense
- func XOr(a, b Dense) Dense
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
Types ¶
type Dense ¶
type Dense struct {
// contains filtered or unexported fields
}
A Dense is a bitmap where every bit is explicitly represented.
func DenseFromProto ¶
func DenseFromProto(dba *bb84pb.DenseBitArray) Dense
FromProto converts a DenseBitArray protocol buffer to a dense Map.
func FromString ¶
FromString converts a string of '1's and '0's to a DenseBitArray.
func NewDense ¶
NewDense returns a new dense bitmap whose contents are a view of data, and whose length is bitLen. If bitLen is longer than data, then trailing zeros are added. If bitLen is negative, then it is inferred from data.
func (Dense) Data ¶
Data returns a view of the bytes underlying this bitmap. Modifying the returned slice modifies this bitmap.
func (*Dense) Shuffle ¶
Shuffle randomly permutes the contents of d, using r as a source of randomness.
func (Dense) Size ¶
Size returns the number of bits in this bitmap, excluding implicit trailing zeros.
func (Dense) SizeBytes ¶
SizeBytes returns the number of bytes in this bitmap, excluding implicit trailing zeros.
func (*Dense) ToProto ¶
func (d *Dense) ToProto() *bb84pb.DenseBitArray
ToProto converts d into an equivalent DenseBitArray proto.