leb128

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

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

Go to latest
Published: Dec 3, 2015 License: BSD-2-Clause Imports: 3 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
	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

func DecodeSLeb128(value []byte) int64

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

func DecodeULeb128

func DecodeULeb128(value []byte) uint64

DecodeULeb128 decodes an unsigned LEB128 value to an unsigned int64 value. Returns the result as a uint64

func EncodeSLeb128

func EncodeSLeb128(value int64) []byte

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

func EncodeULeb128

func EncodeULeb128(value uint64) []byte

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.

Jump to

Keyboard shortcuts

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