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 MaxUint32 = 1<<32 - 1 MaxUint64 = 1<<64 - 1 )
These consts are here in their entirity even though MinInt32 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 int32 value. Returns the result as a int32
func DecodeULeb128 ¶
DecodeULeb128 decodes an unsigned LEB128 value to an unsigned int32 value. Returns the result as a uint32
func EncodeSLeb128 ¶
EncodeSLeb128 encode a signed int32 value to a signed LEB128 value. Returns the result in a byte slice
func EncodeULeb128 ¶
EncodeULeb128 encode's an unsigned int32 value to an unsigned LEB128 value. Returns the result in a byte slice
func ReadSLeb128 ¶
func ReadSLeb128(reader io.ByteReader) int32
ReadSLeb128 reads and decodes a signed LEB128 value from a ByteReader to a signed int32 value. Returns the result as a int32
func ReadULeb128 ¶
func ReadULeb128(reader io.ByteReader) uint32
ReadULeb128 reads and decodes an unsigned LEB128 value from a ByteReader to an unsigned int32 value. Returns the result as a uint32
Types ¶
This section is empty.