Documentation
¶
Overview ¶
Package binary translates between unsigned integers and byte sequences, and encodes varints.
Index ¶
- Constants
- Variables
- func AppendUvarint(buf []byte, x uint64) []byte
- func AppendVarint(buf []byte, x int64) []byte
- func PutUvarint(buf []byte, x uint64) int
- func PutVarint(buf []byte, x int64) int
- func Uvarint(buf []byte) (uint64, int)
- func Varint(buf []byte) (int64, int)
- type AppendByteOrder
- type ByteOrder
Constants ¶
View Source
const ( MaxVarintLen16 = 3 MaxVarintLen32 = 5 MaxVarintLen64 = 10 )
Maximum encoded lengths of varints.
Variables ¶
View Source
var BigEndian bigEndian
BigEndian is the big-endian ByteOrder and AppendByteOrder.
View Source
var LittleEndian littleEndian
LittleEndian is the little-endian ByteOrder and AppendByteOrder.
Functions ¶
func AppendUvarint ¶
AppendUvarint appends the varint encoding of x to buf.
func AppendVarint ¶
AppendVarint appends the zig-zag varint encoding of x to buf.
func PutUvarint ¶
PutUvarint encodes x into buf, which must be large enough, and returns the number of bytes written.
Types ¶
Click to show internal directories.
Click to hide internal directories.