Documentation ¶
Overview ¶
Package table defines interfaces to be implemented by tabular functions. A table maps one (or sometimes two) byte(s) to another primitive type (nibble, byte, word, ...). They're not necessarily injective or surjective. A series of Byte tables can be composed indefinitely, but a Nibble, Word, or Block table will terminate the series.
Index ¶
- func SerializeBlock(t Block) (out []byte)
- func SerializeByte(t Byte) []byte
- func SerializeDoubleToByte(t DoubleToByte) (out []byte)
- func SerializeDoubleToWord(t DoubleToWord) (out []byte)
- func SerializeNibble(t Nibble) (out []byte)
- func SerializeWord(t Word) (out []byte)
- type Block
- type Byte
- type ComposedBytes
- type ComposedToBlock
- type ComposedToWord
- type DoubleToByte
- type DoubleToWord
- type IdentityByte
- type InvertibleTable
- type Nibble
- type ParsedBlock
- type ParsedByte
- type ParsedDoubleToByte
- type ParsedDoubleToWord
- type ParsedNibble
- type ParsedWord
- type Word
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func SerializeBlock ¶
SerializeBlock serializes a Block table to a byte slice.
func SerializeByte ¶
SerializeByte serializes a Byte table to a byte slice.
func SerializeDoubleToByte ¶
func SerializeDoubleToByte(t DoubleToByte) (out []byte)
SerializeDoubleToByte serializes a DoubleToByte table to a byte slice.
func SerializeDoubleToWord ¶
func SerializeDoubleToWord(t DoubleToWord) (out []byte)
SerializeDoubleToWord serializes a DoubleToWord table to a byte slice.
func SerializeNibble ¶
SerializeNibble serializes a Nibble table to a byte slice.
func SerializeWord ¶
SerializeWord serializes a Word table to a byte slice.
Types ¶
type ComposedBytes ¶
type ComposedBytes []Byte
ComposedBytes converts an array of Byte tables into one by chaining them. Tables are chained in REVERSE order than they would be in function composition notation.
Example:
f := ComposedBytes([]Byte{A, B, C}) // f(x) = C(B(A(x)))
func (ComposedBytes) Get ¶
func (cb ComposedBytes) Get(i byte) byte
type ComposedToBlock ¶
ComposedToBlock composes a Byte table and a Block table, giving a new Block table.
func (ComposedToBlock) Get ¶
func (cb ComposedToBlock) Get(i byte) [16]byte
type ComposedToWord ¶
ComposedToWord composes a Byte table and a Word table, giving a new Word table.
func (ComposedToWord) Get ¶
func (cw ComposedToWord) Get(i byte) [4]byte
type DoubleToByte ¶
type DoubleToWord ¶
type IdentityByte ¶
type IdentityByte struct{}
IdentityByte is the identity operation on bytes.
func (IdentityByte) Get ¶
func (ib IdentityByte) Get(i byte) byte
type InvertibleTable ¶
type InvertibleTable Byte
InvertibleTable is a sloppy way to invert permutation tables that aren't encodings for some reason.
func Invert ¶
func Invert(it InvertibleTable) InvertibleTable
type ParsedBlock ¶
type ParsedBlock []byte
ParsedBlock wraps a serialized Block table, giving random access functionality.
func (ParsedBlock) Get ¶
func (pbt ParsedBlock) Get(i byte) (out [16]byte)
type ParsedByte ¶
type ParsedByte []byte
ParsedByte wraps a serialized Byte table, giving random access functionality.
func (ParsedByte) Get ¶
func (pst ParsedByte) Get(i byte) byte
type ParsedDoubleToByte ¶
type ParsedDoubleToByte []byte
ParsedDoubleToByte wraps a serialized DoubleToByte table, giving random access functionality.
func (ParsedDoubleToByte) Get ¶
func (pdtb ParsedDoubleToByte) Get(i [2]byte) byte
type ParsedDoubleToWord ¶
type ParsedDoubleToWord []byte
ParsedDoubleToWord wraps a serialized DoubleToWord table, giving random access functionality.
func (ParsedDoubleToWord) Get ¶
func (pdtw ParsedDoubleToWord) Get(i [2]byte) (out [4]byte)
type ParsedNibble ¶
type ParsedNibble []byte
ParsedNibble wraps a serialized Nibble table, giving random access functionality.
func (ParsedNibble) Get ¶
func (pnt ParsedNibble) Get(i byte) byte
type ParsedWord ¶
type ParsedWord []byte
ParsedWord wraps a serialized Word table, giving random access functionality.
func (ParsedWord) Get ¶
func (pbt ParsedWord) Get(i byte) (out [4]byte)