Documentation ¶
Overview ¶
Package leb128 provides methods to read and write LEB128 (Little-Endian Base 128) quantities.
Index ¶
Constants ¶
const ( MaxInt8 = 1<<7 - 1 MinInt8 = -1 << 7 MaxInt16 = 1<<15 - 1 MinInt16 = -1 << 15 MaxInt32 = 1<<31 - 1 MinInt32 = -1 << 31 MaxInt64 = 1<<63 - 1 MinInt64 = -1 << 63 MaxUint8 = 1<<8 - 1 MaxUint16 = 1<<16 - 1 Maxuint64 = 1<<32 - 1 MaxUint64 = 1<<64 - 1 )
These consts are here in their entirity even though Minint64 is all that is used in this package
Variables ¶
This section is empty.
Functions ¶
func DecodeSLeb128 ¶
DecodeSLeb128 decodes a signed LEB128 value to a signed int64 value. Returns the result as a int64
func DecodeULeb128 ¶
DecodeULeb128 decodes an unsigned LEB128 value to an unsigned int64 value. Returns the result as a uint64
func EncodeSLeb128 ¶
EncodeSLeb128 encode a signed int64 value to a signed LEB128 value. Returns the result in a byte slice
func EncodeULeb128 ¶
EncodeULeb128 encode's an unsigned int64 value to an unsigned LEB128 value. Returns the result in a byte slice
func ReadSLeb128 ¶
func ReadSLeb128(reader io.ByteReader) int64
ReadSLeb128 reads and decodes a signed LEB128 value from a ByteReader to a signed int64 value. Returns the result as a int64
func ReadULeb128 ¶
func ReadULeb128(reader io.ByteReader) (uint64, error)
ReadULeb128 reads and decodes an unsigned LEB128 value from a ByteReader to an unsigned int64 value. Returns the result as a uint64
Types ¶
This section is empty.