varintf

package
v0.6.0 Latest Latest
Warning

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

Go to latest
Published: Jul 12, 2019 License: MIT Imports: 1 Imported by: 0

Documentation

Overview

Package varintf implements Factom's varInt_F specification.

The varInt_F specifications uses the top bit (0x80) in each byte as the continuation bit. If this bit is set, continue to read the next byte. If this bit is not set, then this is the last byte. The remaining 7 bits are the actual data of the number. The bytes are ordered big endian, unlike the varInt used by protobuf or provided by package encoding/binary.

https://github.com/FactomProject/FactomDocs/blob/master/factomDataStructureDetails.md#variable-integers-varint_f

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func Decode

func Decode(buf []byte) (uint64, int)

Decode varInt_F bytes into a uint64 and return the number of bytes used. If buf encodes a number larger than 64 bits, 0 and -1 is returned.

func Encode

func Encode(x uint64) []byte

Encode x into varInt_F bytes.

Types

This section is empty.

Jump to

Keyboard shortcuts

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