bin

package
v0.0.0-...-ec3616b Latest Latest
Warning

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

Go to latest
Published: Feb 24, 2025 License: 0BSD Imports: 4 Imported by: 0

Documentation

Overview

Package bin enables you to represent binary formats.

Bin Tag

The 'bin' tag format is used to specify how arguments are converted to binary on a bit-by-bit level. Each output byte is space-seperated, and each byte can either be a literal hex value (starting with '0x'), or a bit sequence. The bit sequence can contain substitutions based on the tagged function's arguments 'a', 'b', 'c' or 'd'.

  • a: will be replaced with the Nth bit of 'a' where N is the number of occurences of 'a' so far in the tag.

  • [a000]: 'a' is the 1st argument and will be written here wrapped as a 3bit value (the number of zeros determines the number of bits written).

  • [a>n]: 'a' is the 1st argument and a 1 will be written here if the value of 'a' is greater than n, otherwise a 0 will be written. n can be any integer.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

This section is empty.

Types

type Format

type Format interface {
	// contains filtered or unexported methods
}

Format should be embedded inside of an binary format.

type Writer

type Writer[Encoder Format] struct {
	Encoder *Encoder
	// contains filtered or unexported fields
}

Writer for a specific binary format.

func NewWriter

func NewWriter[Encoder Format]() Writer[Encoder]

NewWriter returns a new writer using the given assembly format.

func (*Writer[T]) Bytes

func (src *Writer[T]) Bytes() []byte

Directories

Path Synopsis
std
cpu
cpu/amd64
Package amd64 provides an instruction set specification for the AMD64 architecture.
Package amd64 provides an instruction set specification for the AMD64 architecture.
cpu/arm64
Package arm64 provides an instruction set specification for the ARM64 architecture.
Package arm64 provides an instruction set specification for the ARM64 architecture.

Jump to

Keyboard shortcuts

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