bitstr

package
v0.0.7 Latest Latest
Warning

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

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

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func HasPrefix

func HasPrefix(x, p Source) bool

HasPrefix returns true if the first len(p) bits of x are equal to p.

Types

type Buffer

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

Buffer is a mutable resizable bit string.

func (*Buffer) Append

func (b *Buffer) Append(x bool)

Append adds a single bit to the end of buffer

func (*Buffer) AppendAll

func (b *Buffer) AppendAll(x Source)

AppendAll adds all the bits in x to the end of buffer.

func (*Buffer) AppendByteLSB

func (b *Buffer) AppendByteLSB(x byte)

AppendByteLSB appends all the bits in x, with the LSB first.

func (*Buffer) AppendByteMSB

func (b *Buffer) AppendByteMSB(x byte)

AppendByteMSB appends all the bits in x, with the MSB first.

func (*Buffer) AsBytesLSB

func (b *Buffer) AsBytesLSB() ([]byte, int)

func (*Buffer) AsBytesMSB

func (b *Buffer) AsBytesMSB() ([]byte, int)

func (*Buffer) At

func (b *Buffer) At(i int) bool

func (*Buffer) BitString

func (b *Buffer) BitString() String

func (*Buffer) Len

func (b *Buffer) Len() int

func (*Buffer) Reset

func (b *Buffer) Reset()

func (*Buffer) Set

func (b *Buffer) Set(i int, x bool)

func (*Buffer) Truncate

func (b *Buffer) Truncate(n int)

type BytesLSB

type BytesLSB struct {
	Bytes []byte
	Begin int
	End   int
}

BytesLSB is a source of bits, backed by a []byte The LSB is considered the first bit in a byte.

func (BytesLSB) At

func (x BytesLSB) At(i int) bool

func (BytesLSB) Len

func (x BytesLSB) Len() int

type BytesMSB

type BytesMSB struct {
	Bytes []byte
	Begin int
	End   int
}

BytesMSB is a source of bits, backed by a []byte The MSB is considered the first bit in a byte.

func (BytesMSB) At

func (x BytesMSB) At(i int) bool

func (BytesMSB) Len

func (x BytesMSB) Len() int

type Slice

type Slice struct {
	Source Source
	Begin  int
	End    int
}

func (Slice) At

func (x Slice) At(i int) bool

func (Slice) Len

func (x Slice) Len() int

type Source

type Source interface {
	At(i int) bool
	Len() int
}

Source is a source of bits.

type String

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

String is an immutable string of bits

func Concat

func Concat(a, b String) String

Concat returns the result of a concatenated with b

func FromSource

func FromSource(s Source) String

FromSource creates a new String from a Source

func (String) AsBytesLSB

func (s String) AsBytesLSB() ([]byte, int)

func (String) AsBytesMSB

func (s String) AsBytesMSB() ([]byte, int)

func (String) At

func (s String) At(i int) bool

func (String) Len

func (s String) Len() int

func (String) Slice

func (s String) Slice(begin, end int) String

func (String) String

func (s String) String() string

Jump to

Keyboard shortcuts

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