bytesutil

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

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

Go to latest
Published: Apr 9, 2020 License: MIT Imports: 4 Imported by: 40

README

bytesutil

MIT License go.dev reference Discord Chat

Utilities for reducing memory allocations in Go w/ 100% unit test coverage.

  • Zero-allocation conversion between string and byte slice.
  • Zero-allocation signed/unsigned variable integer encoding/decoding.
  • Zero-allocation signed/unsigned 64-bit/32-bit/16-bit integer encoding/decoding.
  • Extend slice to a sufficient length.

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AppendBitcoinUvarInt

func AppendBitcoinUvarInt(dst []byte, v uint64) []byte

func AppendUint16BE

func AppendUint16BE(dst []byte, n uint16) []byte

func AppendUint16LE

func AppendUint16LE(dst []byte, n uint16) []byte

func AppendUint32BE

func AppendUint32BE(dst []byte, n uint32) []byte

func AppendUint32LE

func AppendUint32LE(dst []byte, n uint32) []byte

func AppendUint64BE

func AppendUint64BE(dst []byte, n uint64) []byte

func AppendUint64LE

func AppendUint64LE(dst []byte, n uint64) []byte

func AppendUvarInt

func AppendUvarInt(dst []byte, n uint64) []byte

func AppendVarInt

func AppendVarInt(dst []byte, n int64) []byte

func BitcoinUvarInt

func BitcoinUvarInt(b []byte) (uint64, int)

func ExtendSlice

func ExtendSlice(dst []byte, size int) []byte

func RandomSlice

func RandomSlice(dst []byte) []byte

func Slice

func Slice(s string) []byte

func String

func String(b []byte) string

func Uint16BE

func Uint16BE(b []byte) uint16

func Uint16LE

func Uint16LE(b []byte) uint16

func Uint32BE

func Uint32BE(b []byte) uint32

func Uint32LE

func Uint32LE(b []byte) uint32

func Uint64BE

func Uint64BE(b []byte) uint64

func Uint64LE

func Uint64LE(b []byte) uint64

func UvarInt

func UvarInt(b []byte) (uint64, int)

func VarInt

func VarInt(b []byte) (int64, int)

Types

This section is empty.

Jump to

Keyboard shortcuts

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