Common byte operations on arrays and slices in Rust.
The Bytes
trait
contains all operations for this crate. As of this writing, they are:
-
is
: indicates whether every byte in a value equals a certain byte. -
contains
: indicates whether any byte in a value equals a certain byte. -
{first,last}_{eq,ne}{,_mut}
: returns a [mutable] reference to the first/last byte that is [not] equal to a certain byte.
This crate contains SIMD-accelerated
implementations, which can be enabled via the simd
feature. This enables
parallel operations on values with 128 bits (or more).
[dependencies.byte-ops]
version = "0.1.0"
features = ["simd"]
Nightly only: as of this writing, this is only available on Rust nightly.
When targeting x86, some extra performance can be gained by enabling advanced vector extensions. This allows for parallel operations on 256 bits. Note that this comes with a compatibility tradeoff. See CPUs with AVX.
To enable AVX, set the following compilation environment variable:
RUSTFLAGS="-C target-feature +avx"
This library is licensed under either of
at your option.