bitpack

package module
v0.0.0-...-3a9469f Latest Latest
Warning

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

Go to latest
Published: Apr 29, 2024 License: Apache-2.0 Imports: 2 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ByteWidth

func ByteWidth(b []byte) int

ByteWidth returns the amount of bytes used to encode each element in the input from the encoded byte slice

func DecodeUint64FromString

func DecodeUint64FromString(enc string) (res uint64)

DecodeUint64FromString converts a string representation of a uint64 back to its numeric representation

func EncodeUint64ToByteBuf

func EncodeUint64ToByteBuf(num uint64, buf []byte) (n int)

EncodeUint64ToByteBuf converts a uint64 to the smallest possible byte representation using only alphanumeric characters (compatible e.g. with filesystem limitations) using a buffer (must have sufficient size

func EncodeUint64ToString

func EncodeUint64ToString(num uint64) string

EncodeUint64ToString converts a uint64 to the smallest possible strinng representation using only alphanumeric characters (compatible e.g. with filesystem limitations)

func EncodeUint64ToStringBuf

func EncodeUint64ToStringBuf(num uint64, buf []byte) string

EncodeUint64ToStringBuf converts a uint64 to the smallest possible strinng representation using only alphanumeric characters (compatible e.g. with filesystem limitations) using a buffer (must have sufficient size

func Len

func Len(b []byte) int

Len returns the number of encoded elements in the compressed bfer / byte slice

func Pack

func Pack(data []uint64) []byte

Pack compresses a slice of uint64 values into a byte slice using the minimal possible number of bytes to represent all values in the input slice. The first byte of the output is reserved to hold the byte with for decompression

func Uint64At

func Uint64At(b []byte, at int, neededBytes int) uint64

Uint64At returns the decoded singular value from the provided slice at a given index from the original slice

func Unpack

func Unpack(b []byte) []uint64

Unpack decompresses a previously compressed data slice into the original slice of uint64 values

func UnpackInto

func UnpackInto(b []byte, res []uint64) []uint64

UnpackInto decompresses a compressed byte slice into a pre-existing slice of uint64 values (which will be allocated / grown in case its capacity is insufficient)

Types

This section is empty.

Jump to

Keyboard shortcuts

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