pforenc

package
v0.0.0-...-d60b6d4 Latest Latest
Warning

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

Go to latest
Published: Aug 24, 2026 License: BSD-3-Clause Imports: 3 Imported by: 0

Documentation

Overview

Package pforenc contains a Go TurboPFor encoder.

Index

Constants

View Source
const LargestP4 = 1025

LargestP4 is the largest number of bytes our encoder will emit when encoding 256 uint32 values in TurboPFor format (safe upper bound for buffers).

Variables

This section is empty.

Functions

This section is empty.

Types

type BlockEncoder

type BlockEncoder struct {
	// contains filtered or unexported fields
}

BlockEncoder encodes one or more TurboPFor blocks, each containing at most 256 values (for efficient SIMD processing).

A zero value BlockEncoder is ready to use. BlockEncoder is not safe for concurrent use by multiple goroutines.

func (*BlockEncoder) EncodeBlock

func (be *BlockEncoder) EncodeBlock(dest []byte, vals []uint32) []byte

EncodeBlock encodes len(vals)<=256 uint32s into dest (one TurboPFor block).

func (*BlockEncoder) EncodeN

func (be *BlockEncoder) EncodeN(dest []byte, vals []uint32) []byte

EncodeN encodes len(vals) uint32s into dest, in TurboPFor blocks of at most 256 values.

type StreamEncoder

type StreamEncoder struct {
	// contains filtered or unexported fields
}

StreamEncoder accumulates uint32s until one full TurboPFor block, then encodes that block for writing it to disk/network.

A zero value StreamEncoder is ready to use. StreamEncoder is not safe for concurrent use by multiple goroutines.

func (*StreamEncoder) Add

func (se *StreamEncoder) Add(val uint32) (full bool)

Add stores val in the StreamEncoder's buffer.

Contract: When Add returns true (full), you must EncodeBlock().

func (*StreamEncoder) EncodeBlock

func (se *StreamEncoder) EncodeBlock() []byte

EncodeBlock encodes the accumulated values in TurboPFor format and returns the bytes of the (full or remainder) block.

Contract: the returned bytes are valid until the next EncodeBlock.

Jump to

Keyboard shortcuts

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