bitpack

package
v0.0.0-...-1a9adb5 Latest Latest
Warning

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

Go to latest
Published: Mar 20, 2024 License: Apache-2.0 Imports: 3 Imported by: 0

Documentation

Overview

Package bitpack implements efficient bit packing and unpacking routines for integers of various bit widths.

Index

Constants

View Source
const PaddingInt32 = 16

PaddingInt32 is the padding expected to exist after the end of input buffers for the UnpackInt32 algorithm to avoid reading beyond the end of the input.

View Source
const PaddingInt64 = 32

PaddingInt64 is the padding expected to exist after the end of input buffers for the UnpackInt32 algorithm to avoid reading beyond the end of the input.

Variables

This section is empty.

Functions

func ByteCount

func ByteCount(bitCount uint) int

ByteCount returns the number of bytes needed to hold the given bit count.

func PackInt32

func PackInt32(dst []byte, src []int32, bitWidth uint)

PackInt32 packs values from src to dst, each value is packed into the given bit width regardless of how many bits are needed to represent it.

The function panics if dst is too short to hold the bit packed values.

func PackInt64

func PackInt64(dst []byte, src []int64, bitWidth uint)

PackInt64 packs values from src to dst, each value is packed into the given bit width regardless of how many bits are needed to represent it.

The function panics if dst is too short to hold the bit packed values.

func UnpackInt32

func UnpackInt32(dst []int32, src []byte, bitWidth uint)

UnpackInt32 unpacks 32 bit integers from src to dst.

The function unpacked len(dst) integers, it panics if src is too short to contain len(dst) values of the given bit width.

func UnpackInt64

func UnpackInt64(dst []int64, src []byte, bitWidth uint)

UnpackInt64 unpacks 64 bit integers from src to dst.

The function unpacked len(dst) integers, it panics if src is too short to contain len(dst) values of the given bit width.

Types

This section is empty.

Jump to

Keyboard shortcuts

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