Expand description
SIMD-accelerated engines for the standard and URL-safe alphabets.
These are gated behind the simd-unsafe feature because they use unsafe. Three engines are
provided:
Simddetects the best available instruction set at runtime and falls back to the scalarGeneralPurposeengine when none is available. It requiresstdfor the detection.Avx2andNeontarget a specific instruction set with no runtime detection, so they can be used inno_stdbuilds when the target is known to support the instructions.
Only the STANDARD and URL_SAFE alphabets are accelerated (they share indices 0..=61 and differ
only at 62/63). Each engine therefore has dedicated standard / url_safe constructors
rather than taking an arbitrary Alphabet; use GeneralPurpose
for any other alphabet.
The kernels follow Wojciech Mula’s vectorized base64 algorithms
(http://0x80.pl/notesen/2016-01-17-sse-base64-decoding.html and the companion encoding note).
AVX2 uses the multiply-based bit (de)interleave; NEON, which lacks the relevant multiplies, uses
the shift/mask variant. Both share the same per-alphabet lookup tables, expressed as the
associated constants of the SimdAlphabet trait so the kernels can inline them.
Structs§
- Avx2
- A base64 engine that unconditionally uses AVX2, without runtime detection.
- Simd
- A base64 engine that uses the best SIMD instruction set detected at runtime, falling back to the
scalar
GeneralPurposeengine.