Documentation ¶
Overview ¶
Package bitstream is used to read bits out of any given reader. It can operate in regular or "shift up" mode which determines how reads across byte-alignment construct values (with the current or the next byte able to become the most significant bits). It also has optimized fast-paths on byte alignments.
Index ¶
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
This section is empty.
Types ¶
type Reader ¶
type Reader struct { // Bits returns the next bits up to a max of 64. Bits func(nBits int) (val uint64, err error) // Bytes returns the number of requested bits inside a byte array. Bytes func(dst []byte, nBits int) (err error) // contains filtered or unexported fields }
Reader reads many different types of values outside byte alignments.
func New ¶
New constructs a reader that shifts the next byte up to become the most significant bits. Given data: 1010 0000 | 0000 0101, a read of Bits(16) will yield: 0000 0101 1010 0000
func NewShiftUp ¶
NewShiftUp constructs a reader that shifts the current byte up to become the most significant bits. Given data: 1010 0000 | 0000 0101, a read of Bits(16) will yield: 1010 0000 0000 0101