Documentation ¶
Overview ¶
Package leb128 provides functions for reading integer values encoded in the Little Endian Base 128 (LEB128) format: https://en.wikipedia.org/wiki/LEB128
Index ¶
- func AppendSleb128(b []byte, v int64) []byte
- func AppendUleb128(b []byte, v uint64) []byte
- func ReadVarUint32(r io.Reader) (uint32, error)
- func ReadVarUint32Size(r io.Reader) (res uint32, size uint, err error)
- func ReadVarint32(r io.Reader) (int32, error)
- func ReadVarint32Size(r io.Reader) (res int32, size uint, err error)
- func ReadVarint64(r io.Reader) (int64, error)
- func ReadVarint64Size(r io.Reader) (res int64, size uint, err error)
- func WriteVarUint32(w io.Writer, cur uint32) (int, error)
- func WriteVarint64(w io.Writer, cur int64) (int, error)
Constants ¶
This section is empty.
Variables ¶
This section is empty.
Functions ¶
func AppendSleb128 ¶ added in v0.2.0
AppendSleb128 appends v to b using signed LEB128 encoding.
func AppendUleb128 ¶ added in v0.2.0
AppendUleb128 appends v to b using unsigned LEB128 encoding.
func ReadVarUint32 ¶
ReadVarUint32 reads a LEB128 encoded unsigned 32-bit integer from r, and returns the integer value, and the error (if any).
func ReadVarUint32Size ¶
ReadVarUint32Size reads a LEB128 encoded unsigned 32-bit integer from r. It returns the integer value, the size of the encoded value (in bytes), and the error (if any).
func ReadVarint32 ¶
ReadVarint32 reads a LEB128 encoded signed 32-bit integer from r, and returns the integer value, and the error (if any).
func ReadVarint32Size ¶
ReadVarint32Size reads a LEB128 encoded signed 32-bit integer from r, and returns the integer value, the size of the encoded value, and the error (if any)
func ReadVarint64 ¶
ReadVarint64 reads a LEB128 encoded signed 64-bit integer from r, and returns the integer value, and the error (if any).
func ReadVarint64Size ¶
ReadVarint64Size reads a LEB128 encoded signed 64-bit integer from r, and returns the integer value, the size of the encoded value, and the error (if any)
func WriteVarUint32 ¶ added in v0.2.0
WriteVarUint32 writes a LEB128 encoded unsigned 32-bit integer to w. It returns the integer value, the size of the encoded value (in bytes), and the error (if any).
Types ¶
This section is empty.