Documentation ¶
Index ¶
- func AppendBackward[T constraints.Integer](dst []byte, value T) []byte
- func AppendForward[T constraints.Integer](dst []byte, value T) []byte
- func ConsumeBackward[T constraints.Integer](src []byte) (T, int)
- func ConsumeForward[T constraints.Integer](src []byte) (T, int)
- func ReadForward[T constraints.Integer](r io.ByteReader) (T, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendBackward ¶
func AppendBackward[T constraints.Integer](dst []byte, value T) []byte
AppendBackward appends an integer value to a byte slice using a variable length encoding, which can be read back in a backward parsing manner.
This encoding is identical to AppendForward, except that bytes are emitted in reverse order.
func AppendForward ¶
func AppendForward[T constraints.Integer](dst []byte, value T) []byte
AppendForward appends an integer value to a byte slice using a variable length encoding, which can be read back in a forward parsing manner.
The encoding used by this function is similar to UTF-8, except that it is simplified to no longer be self-synchronizing. The number of leading 0-bits corresponds to the number of trailing bytes. Trailing bytes do not have any special prefix. Values are sign extended.
func ConsumeBackward ¶
func ConsumeBackward[T constraints.Integer](src []byte) (T, int)
ConsumeBackward consumes an integer value from the head of a byte slice, which was encoded using AppendBackward().
func ConsumeForward ¶
func ConsumeForward[T constraints.Integer](src []byte) (T, int)
ConsumeForward consumes an integer value from the head of a byte slice, which was encoded using AppendForward().
func ReadForward ¶
func ReadForward[T constraints.Integer](r io.ByteReader) (T, error)
Types ¶
This section is empty.