proxy.golang.org : github.com/creachadair/binpack
Package binpack implements a compact binary encoding format. Structured data are represented in binpack as a concatenated sequence of tag-value records. A tag is an unsigned integer value, a value is an array of bytes. The tags and values are opaque to the encoding; the caller must provide additional structure as needed. For example, the application may encode type information in some low-order bits of the tag. Tags are encoded as 1, 2, or 4 bytes, having values up to 2^30-1. Values are length-prefixed byte arrays up to 2^29-1 bytes in length. The encoding of a tag is as follows: The first byte of the tag is called the index, and its high-order two bits determine the size of the tag in bytes (0_=1, 01=2, 11=4). The encoding of a value is as follows: The first byte of the value is called the index, and its high-order three bits determine the size of the length prefix. Small single-byte values are encoded directly with a prefix of 0; otherwise the length is 1, 2, or 4 bytes. Integer types are sign-extended to 64 bits and encoded using PackUint64 or PackInt64 as appropriate. Floating-point values are converted to binary using math.Float64bits or math.Float32bits as appropriate, and the resulting bits are encoded as integers.
Registry
-
Source
- Documentation
- JSON
purl: pkg:golang/github.com/creachadair/binpack
License: MIT
Latest release: over 4 years ago
First release: almost 5 years ago
Namespace: github.com/creachadair
Stars: 0 on GitHub
Forks: 0 on GitHub
See more repository details: repos.ecosyste.ms
Last synced: about 1 month ago