bytes

package
v1.9.4 Latest Latest
Warning

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

Go to latest
Published: Jan 17, 2025 License: BSD-3-Clause, ISC Imports: 1 Imported by: 0

Documentation

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AllZero

func AllZero(b []byte) bool

AllZero reports whether b consists entirely of zero bytes. This simple version is on-par with the assembly, so typically we prefer it for portability.

func AllZeroSIMD

func AllZeroSIMD(b []byte) bool

AllZeroSIMD reports whether b consists entirely of zero bytes. It uses assembly, which may or may not be faster.

func LongestZeroSpan

func LongestZeroSpan(b []byte) (start, length int)

LongestZeroSpan is a simple byte-by-byte implementation for benchmarking. This naive version is on par with the SIMD version above. To see on your machine, run: go test -bench=. -benchmem

func SIMDLongestZeroSpan

func SIMDLongestZeroSpan(b []byte) (start, length int)

LongestZeroSpan returns the start index and length of the longest continuous span of zero bytes in the given slice. If no zeros are found, returns (0, 0). If multiple spans of the same longest length exist, returns the first one.

Types

This section is empty.

Jump to

Keyboard shortcuts

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