Ecosyste.ms: Packages

An open API service providing package, version and dependency metadata of many open source software ecosystems and registries.

Top 8.2% on proxy.golang.org

proxy.golang.org : github.com/agnivade/bitio

Package bitio provides a highly optimized bit-level Reader and Writer. You can use Reader.ReadBits() to read arbitrary number of bits from an io.Reader and return it as an uint64, and Writer.WriteBits() to write arbitrary number of bits of an uint64 value to an io.Writer. Both Reader and Writer also provide highly optimized methods for reading / writing 1 bit of information in the form of a bool value: Reader.ReadBool() and Writer.WriteBool(). These make this package ideal for compression algorithms that use Huffman coding for example, where decision whether to step left or right in the Huffman tree is the most frequent operation. Reader and Writer give a bit-level view of the underlying io.Reader and io.Writer, but they also provide a byte-level view (io.Reader and io.Writer) at the same time. This means you can also use the Reader.Read() and Writer.Write() methods to read and write slices of bytes. These will give you best performance ifthe underlying io.Reader and io.Writer are aligned to a byte boundary (else all the individual bytes are assembled from / spread to multiple bytes). You can ensure byte boundary by calling the Align() method of Reader and Writer. The more general highest-bits-first order is used. So for example if the input provides the bytes 0x8f and 0x55: Then ReadBits will return the following values: Writing the above values would result in the same sequence of bytes:

Registry - Source - Documentation - JSON
purl: pkg:golang/github.com/agnivade/bitio
License: Apache-2.0
Latest release: over 6 years ago
First release: over 6 years ago
Namespace: github.com/agnivade
Last synced: 3 days ago

    Loading...
    Readme
    Loading...