varint

package module
v0.0.1 Latest Latest
Warning

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

Go to latest
Published: Sep 18, 2019 License: MIT Imports: 3 Imported by: 211

README

go-varint

GoDoc Travis CI codecov.io

Varint helpers that enforce minimal encoding.

Table of Contents

Install

go get github.com/multiformats/go-varint

Contribute

Contributions welcome. Please check out the issues.

Check out our contributing document for more information on how we work, and about contributing in general. Please be aware that all interactions related to multiformats are subject to the IPFS Code of Conduct.

Small note: If editing the README, please conform to the standard-readme specification.

License

MIT © 2019 Protocol Labs

Documentation

Index

Constants

This section is empty.

Variables

View Source
var (
	ErrOverflow   = errors.New("varints larger than uint64 not yet supported")
	ErrNotMinimal = errors.New("varint not minimally encoded")
)

Functions

func FromUvarint

func FromUvarint(buf []byte) (uint64, int, error)

FromUvarint reads an unsigned varint from the beginning of buf, returns the varint, and the number of bytes read.

func ToUvarint

func ToUvarint(num uint64) []byte

ToUvarint converts an unsigned integer to a varint-encoded []byte

func UvarintSize

func UvarintSize(num uint64) int

UvarintSize returns the size (in bytes) of `num` encoded as a unsigned varint.

Types

This section is empty.

Jump to

Keyboard shortcuts

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