bitutil

package
v1.0.1 Latest Latest
Warning

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

Go to latest
Published: Aug 3, 2023 License: GPL-3.0 Imports: 3 Imported by: 6

Documentation

Overview

Package bitutil implements fast bitwise operations.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func ANDBytes

func ANDBytes(dst, a, b []byte) int

ANDBytes ands the bytes in a and b. The destination is assumed to have enough space. Returns the number of bytes and'd.

func CompressBytes

func CompressBytes(data []byte) []byte

CompressBytes compresses the input byte slice according to the sparse bitset representation algorithm. If the result is bigger than the original input, no compression is done.

func DecompressBytes

func DecompressBytes(data []byte, target int) ([]byte, error)

DecompressBytes decompresses data with a known target size. If the input data matches the size of the target, it means no compression was done in the first place.

func ORBytes

func ORBytes(dst, a, b []byte) int

ORBytes ors the bytes in a and b. The destination is assumed to have enough space. Returns the number of bytes or'd.

func TestBytes

func TestBytes(p []byte) bool

TestBytes tests whether any bit is set in the input byte slice.

func XORBytes

func XORBytes(dst, a, b []byte) int

XORBytes xors the bytes in a and b. The destination is assumed to have enough space. Returns the number of bytes xor'd.

Types

This section is empty.

Jump to

Keyboard shortcuts

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