leb128

package
v0.0.0-...-3940e3f Latest Latest
Warning

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

Go to latest
Published: Dec 18, 2021 License: BSD-3-Clause Imports: 2 Imported by: 0

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

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendSleb128

func AppendSleb128(b []byte, v int64) []byte

AppendSleb128 appends v to b using signed LEB128 encoding.

func AppendUleb128

func AppendUleb128(b []byte, v uint64) []byte

AppendUleb128 appends v to b using unsigned LEB128 encoding.

func GetVarUint32

func GetVarUint32(b []byte) (uint32, int, error)

GetVarUint32 reads a LEB128 encoded unsigned 32-bit integer from r, and returns the integer value, and the error (if any).

func GetVarUint64

func GetVarUint64(b []byte) (uint64, int, error)

GetVarUint64 reads a LEB128 encoded unsigned 64-bit integer from r, and returns the integer value, and the error (if any).

func GetVarint32

func GetVarint32(b []byte) (int32, int, error)

GetVarint32 reads a LEB128 encoded signed 32-bit integer from r, and returns the integer value, and the error (if any).

func GetVarint64

func GetVarint64(b []byte) (int64, int, error)

GetVarint64 reads a LEB128 encoded signed 64-bit integer from r, and returns the integer value, and the error (if any).

func ReadVarUint32

func ReadVarUint32(r io.Reader) (uint32, error)

ReadVarUint32 reads a LEB128 encoded unsigned 32-bit integer from r, and returns the integer value, and the error (if any).

func ReadVarUint64

func ReadVarUint64(r io.Reader) (uint64, error)

ReadVarUint64 reads a LEB128 encoded unsigned 64-bit integer from r, and returns the integer value, and the error (if any).

func ReadVarint32

func ReadVarint32(r io.Reader) (int32, error)

ReadVarint32 reads a LEB128 encoded signed 32-bit integer from r, and returns the integer value, and the error (if any).

func ReadVarint64

func ReadVarint64(r io.Reader) (int64, error)

ReadVarint64 reads a LEB128 encoded signed 64-bit integer from r, and returns the integer value, and the error (if any).

func WriteVarUint32

func WriteVarUint32(w io.Writer, cur uint32) (int, error)

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).

func WriteVarUint64

func WriteVarUint64(w io.Writer, cur uint64) (int, error)

WriteVarUint64 writes a LEB128 encoded unsigned 64-bit integer to w. It returns the integer value, the size of the encoded value (in bytes), and the error (if any).

func WriteVarint64

func WriteVarint64(w io.Writer, cur int64) (int, error)

WriteVarint64 writes a LEB128 encoded signed 64-bit integer to w, and returns the integer value, the size of the encoded value, and the error (if any)

Types

This section is empty.

Jump to

Keyboard shortcuts

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