leb128

package module
v0.0.0-...-ab52882 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Mar 10, 2014 License: BSD-2-Clause Imports: 2 Imported by: 0

Documentation

Overview

Package leb128 provides methods to read and write LEB128 (Little-Endian Base 128) quantities.

Index

Constants

View Source
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

func DecodeSLeb128(value []byte) int32

DecodeSLeb128 decodes a signed LEB128 value to a signed int32 value. Returns the result as a int32

func DecodeULeb128

func DecodeULeb128(value []byte) uint32

DecodeULeb128 decodes an unsigned LEB128 value to an unsigned int32 value. Returns the result as a uint32

func EncodeSLeb128

func EncodeSLeb128(value int32) []byte

EncodeSLeb128 encode a signed int32 value to a signed LEB128 value. Returns the result in a byte slice

func EncodeULeb128

func EncodeULeb128(value uint32) []byte

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.

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL