table

package
v0.0.0-...-2f25eea Latest Latest
Warning

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

Go to latest
Published: Oct 20, 2016 License: BSD-3-Clause Imports: 0 Imported by: 11

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func SerializeBlock

func SerializeBlock(t Block) (out []byte)

SerializeBlock serializes a Block table to a byte slice.

func SerializeByte

func SerializeByte(t Byte) []byte

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

func SerializeNibble(t Nibble) (out []byte)

SerializeNibble serializes a Nibble table to a byte slice.

func SerializeWord

func SerializeWord(t Word) (out []byte)

SerializeWord serializes a Word table to a byte slice.

Types

type Block

type Block interface {
	Get(i byte) [16]byte
}

type Byte

type Byte interface {
	Get(i byte) byte
}

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

type ComposedToBlock struct {
	Heads Byte
	Tails Block
}

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

type ComposedToWord struct {
	Heads Byte
	Tails Word
}

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 DoubleToByte interface {
	Get(i [2]byte) byte
}

type DoubleToWord

type DoubleToWord interface {
	Get(i [2]byte) [4]byte
}

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

type Nibble

type Nibble interface {
	Get(i byte) byte // Get(i byte) nibble
}

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)

type Word

type Word interface {
	Get(i byte) [4]byte
}

Jump to

Keyboard shortcuts

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