bits

package
v0.0.0-...-39567c2 Latest Latest
Warning

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

Go to latest
Published: Dec 3, 2023 License: MIT Imports: 3 Imported by: 0

Documentation

Index

Constants

View Source
const (
	PTSum     = 0
	PTProduct = 1
	PTMin     = 2
	PTMax     = 3
	PTLiteral = 4
	PTGT      = 5
	PTLT      = 6
	PTEq      = 7
)

Variables

This section is empty.

Functions

func Calculate

func Calculate(pkt *Packet) int

Types

type BitReader

type BitReader struct {
	S string
	// contains filtered or unexported fields
}

func (*BitReader) Consume

func (r *BitReader) Consume(n int) int

func (*BitReader) ConsumeBit

func (r *BitReader) ConsumeBit() int

func (*BitReader) DiscardRestOfDigit

func (r *BitReader) DiscardRestOfDigit()

type Packet

type Packet struct {
	Version    int
	Type       int
	Literal    int // only if pType == ptLiteral
	Subpackets []*Packet
}

func ReadPacket

func ReadPacket(br *BitReader) (*Packet, int, error)

ReadPacket consumes and returns a packet, as well as the total number of bits read or any error. It does *not* skip to the next digit boundary (as would be desirable for a top-level read), so it can be used recursively with operators. Do this manually with br.discardRestOfDigit()

func (*Packet) String

func (p *Packet) String() string

Jump to

Keyboard shortcuts

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