Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ All significant changes to this project will be documented in this file.

### Features

* Add `validate` to all profiles and the `Codec` trait for validating encoded input without allocating or writing decoded bytes, preserving `DecodeError` precedence and byte offsets.
* Add `policy::PaddedOptional` and `policy::UnpaddedOptional` for Base32 and Base64. Both accept complete padding or none when decoding and emit padded and unpadded output, respectively.
* Add `encode_into_uninit` and `decode_into_uninit` to all profiles and the `Codec` trait. They write into caller-provided `MaybeUninit<u8>` storage and return the initialized prefix.

Expand Down
6 changes: 3 additions & 3 deletions bases/ARCHITECTURE.md
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,7 @@ Bases separates observable encoding semantics from execution strategy.

- Parameterized zero-sized family types (`base16::Base16`, `base32::Base32`, `base64::Base64`) combined with `policy` markers (`Padded`, `Unpadded`, `PaddedOptional`, `UnpaddedOptional`, `Lower`, `Upper`, `Mixed`, `Strict`) define an alphabet, padding policy, and case policy, alongside ten crate-root aliases (`Base16Lower`, `Base16Upper`, `Base32`, `Base32Unpadded`, `Base32Hex`, `Base32HexUnpadded`, `Base64`, `Base64Unpadded`, `Base64Url`, `Base64UrlUnpadded`).
- Concrete family types provide direct inherent methods, including `const fn` sizing and constructors (`new`, `name`, `encoded_len`, `max_decoded_len`, `display`, `encoder`, `decoder`), while the sealed `Codec` trait provides the shared contract for generic `C: Codec` callers.
- Caller-buffer operations accept initialized slices (`encode_into`, `decode_into`) or `MaybeUninit<u8>` slices (`encode_into_uninit`, `decode_into_uninit`). Both `decode_in_place` and `decode_array` also operate without allocation. The `alloc` feature adds `encode`, `encode_append`, `decode`, and transactional `decode_append`. The `serde` feature adds `serialize`, `deserialize_array`, and, with `alloc`, `deserialize`.
- Caller-buffer operations accept initialized slices (`encode_into`, `decode_into`) or `MaybeUninit<u8>` slices (`encode_into_uninit`, `decode_into_uninit`). `validate`, `decode_in_place`, and `decode_array` also operate without allocation. The `alloc` feature adds `encode`, `encode_append`, `decode`, and transactional `decode_append`. The `serde` feature adds `serialize`, `deserialize_array`, and, with `alloc`, `deserialize`.
- `Encoder<C>` and `Decoder<C>` preserve one partial quantum for incremental operation without allocation; `std` adds `bases::io::{EncoderWriter, DecoderReader}` over `std::io::{Write, Read}`.
- Formatting adapters (`EncodedDisplay` and explicit-case `HexDisplay`) stream encoded output through `core::fmt`.

Expand All @@ -16,9 +16,9 @@ Each profile maps at compile time to private backend dispatch functions that pai

- `aarch64` NEON (`target_feature = "neon"`) for Base16, Base32, and Base64.
- `x86` and `x86_64` AVX2 and SSSE3 for Base16, Base32, and Base64, using runtime `is_x86_feature_detected!` dispatch under `std` or compile-time `target_feature` selection in `no_std`.
- `wasm32` `simd128` (`target_feature = "simd128"`) for Base16 and Base64.
- `wasm32` `simd128` (`target_feature = "simd128"`) for Base16 and Base64 encoding and decoding, and for Base16, Base32, and Base64 validation.

SIMD backends process bulk prefixes and fall back to the scalar reference implementations for tails and under `cfg!(miri)`. Backend selection is private, and every SIMD kernel preserves exact scalar output, error precedence, error byte offsets, and stream-state contracts.
SIMD backends accelerate bulk inputs and fall back to the scalar reference implementations for short inputs or tails and under `cfg!(miri)`. Backend selection is private, and every SIMD kernel preserves exact scalar output, error precedence, error byte offsets, and stream-state contracts.

The workspace denies `unsafe_code` by default. Scoped allowances cover architecture intrinsics and internal buffer operations, including writing into uninitialized storage and converting initialized ASCII bytes to strings. These operations document their safety invariants, with `missing_safety_doc` and `undocumented_unsafe_blocks` enforced.

Expand Down
6 changes: 5 additions & 1 deletion bases/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ For example, use `base64::Base64<base64::Standard, policy::UnpaddedOptional>` fo

## API layers and features

- **Caller buffers (`no_std`):** `encoded_len`, `max_decoded_len`, `encode_into`, `decode_into`, `decode_in_place`, and `decode_array` operate without allocation. Concrete profiles provide `const fn` constructors and sizing methods.
- **Sizing, validation, and caller buffers (`no_std`):** `encoded_len`, `max_decoded_len`, `validate`, `encode_into`, `decode_into`, `decode_in_place`, and `decode_array` operate without allocation. Concrete profiles provide `const fn` constructors and sizing methods.
- **Owned output (`alloc`):** `encode` and `decode` return `String` and `Vec<u8>`; `encode_append` and transactional `decode_append` extend existing buffers.
- **Streaming (`no_std` / `std`):** `Encoder<C>` and `Decoder<C>` process arbitrarily chunked input while retaining at most one partial quantum. The `std` feature adds `io::EncoderWriter` and `io::DecoderReader` for `std::io::Write` and `std::io::Read`.
- **Formatting (`no_std`):** `display` (`EncodedDisplay`) and `HexDisplay` (`{:x}` and `{:X}` only) write encoded text through `core::fmt` without an intermediate string.
Expand All @@ -65,6 +65,10 @@ For example, use `base64::Base64<base64::Standard, policy::UnpaddedOptional>` fo
| `std` | Enables `alloc`, I/O adapters, and runtime x86/x86_64 CPU feature detection. |
| `serde` | Adds `serde_core` serialization and fixed-array deserialization, including without an allocator. |

## Validation without decoding

Use `validate(input)` when an encoded field is stored or forwarded without materializing decoded bytes. It enforces the profile's complete alphabet, padding, case, and canonical trailing-bit rules, returning the same `DecodeError` and byte offset as decoding with sufficient output capacity. Calling `validate` immediately before decoding the same input duplicates validation work.

## Uninitialized output buffers

Use `encode_into_uninit` or `decode_into_uninit` when the destination is an uninitialized stack buffer or a vector's spare capacity. Use the returned slice to access the result. For padded Base64, it can be shorter than the decoding size estimate.
Expand Down
33 changes: 33 additions & 0 deletions bases/src/backend/base16.rs
Original file line number Diff line number Diff line change
Expand Up @@ -27,6 +27,21 @@ const MIXED_DECODE_LUT: [u8; 256] = make_decode_lut(true, true);
const UPPER_DECODE_LUT: [u8; 256] = make_decode_lut(true, false);
const LOWER_DECODE_LUT: [u8; 256] = make_decode_lut(false, true);

const HI_MASK_MIXED: [u8; 16] = [0, 0, 0, 1, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_UPPER: [u8; 16] = [0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_LOWER: [u8; 16] = [0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const LO_MASK: [u8; 16] = [1, 7, 7, 7, 7, 7, 7, 1, 1, 1, 0, 0, 0, 0, 0, 0];

const fn select_hi_mask<const UPPERCASE: bool, const STRICT_CASE: bool>() -> &'static [u8; 16] {
if !STRICT_CASE {
&HI_MASK_MIXED
} else if UPPERCASE {
&HI_MASK_UPPER
} else {
&HI_MASK_LOWER
}
}

const fn make_decode_lut(allow_upper: bool, allow_lower: bool) -> [u8; 256] {
let mut lut = [0xff_u8; 256];
let mut byte = b'0';
Expand Down Expand Up @@ -89,6 +104,24 @@ pub fn decode_plan(input: &[u8]) -> Result<DecodePlan, DecodeError> {
})
}

/// Validates Base16 alphabet symbols after input length has been validated.
#[inline]
pub fn validate_with_plan<const UPPERCASE: bool, const STRICT_CASE: bool>(
input: &[u8],
plan: DecodePlan,
) -> Result<(), DecodeError> {
debug_assert_eq!(plan.data_len, input.len());
let lut = select_decode_lut::<UPPERCASE, STRICT_CASE>();
let hi_mask = select_hi_mask::<UPPERCASE, STRICT_CASE>();
if let Some(index) = backend::validate_symbols(input, lut, hi_mask, &LO_MASK) {
return Err(DecodeError::InvalidByte {
index,
byte: input[index],
});
}
Ok(())
}

/// Encodes `input` into `output` using Base16, returning the number of bytes written.
#[inline(always)]
pub fn encode<const UPPERCASE: bool>(input: &[u8], output: &mut [MaybeUninit<u8>]) -> usize {
Expand Down
18 changes: 3 additions & 15 deletions bases/src/backend/base16/arch/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -40,25 +40,13 @@ use core::arch::aarch64::vzip1q_u8;
use core::arch::aarch64::vzip2q_u8;
use core::mem::MaybeUninit;

use crate::backend::base16::LO_MASK;
use crate::backend::base16::select_hi_mask;

const UPPER_HEX: &[u8; 16] = b"0123456789ABCDEF";
const LOWER_HEX: &[u8; 16] = b"0123456789abcdef";

const HI_MASK_MIXED: [u8; 16] = [0, 0, 0, 1, 2, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_UPPER: [u8; 16] = [0, 0, 0, 1, 2, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_LOWER: [u8; 16] = [0, 0, 0, 1, 0, 0, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const LO_MASK: [u8; 16] = [1, 7, 7, 7, 7, 7, 7, 1, 1, 1, 0, 0, 0, 0, 0, 0];
const HI_OFFSET: [u8; 16] = [0, 0, 0, 0, 9, 0, 9, 0, 0, 0, 0, 0, 0, 0, 0, 0];

const fn select_hi_mask<const UPPERCASE: bool, const STRICT_CASE: bool>() -> &'static [u8; 16] {
if !STRICT_CASE {
&HI_MASK_MIXED
} else if UPPERCASE {
&HI_MASK_UPPER
} else {
&HI_MASK_LOWER
}
}

#[inline]
pub fn encode<const UPPERCASE: bool>(
input: &[u8],
Expand Down
84 changes: 64 additions & 20 deletions bases/src/backend/base32.rs
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,22 @@ const HEX_DECODE_MIXED: [u8; 256] = make_decode_lut(true, true, true);
const HEX_DECODE_UPPER: [u8; 256] = make_decode_lut(true, true, false);
const HEX_DECODE_LOWER: [u8; 256] = make_decode_lut(true, false, true);

const HI_MASK_MIXED: [u8; 16] = [0, 0, 0, 1, 2, 4, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_UPPER: [u8; 16] = [0, 0, 0, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_LOWER: [u8; 16] = [0, 0, 0, 1, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0];
const LO_MASK_STD: [u8; 16] = [4, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 2, 2, 2, 2, 2];
const LO_MASK_HEX: [u8; 16] = [5, 7, 7, 7, 7, 7, 7, 3, 3, 3, 2, 2, 2, 2, 2, 2];

const fn select_hi_mask<const UPPERCASE: bool, const STRICT_CASE: bool>() -> &'static [u8; 16] {
if !STRICT_CASE {
&HI_MASK_MIXED
} else if UPPERCASE {
&HI_MASK_UPPER
} else {
&HI_MASK_LOWER
}
}

const fn make_decode_lut(extended_hex: bool, allow_upper: bool, allow_lower: bool) -> [u8; 256] {
let mut lut = [0xff_u8; 256];
if extended_hex {
Expand Down Expand Up @@ -210,6 +226,34 @@ pub fn decode_plan<const PADDED: bool>(input: &[u8]) -> Result<DecodePlan, Decod
}
}

/// Validates Base32 alphabet symbols and unused trailing bits using `plan`.
#[inline]
pub fn validate_with_plan<
const EXTENDED_HEX: bool,
const UPPERCASE: bool,
const STRICT_CASE: bool,
>(
input: &[u8],
plan: DecodePlan,
) -> Result<(), DecodeError> {
let data = &input[..plan.data_len];
let lut = select_decode_lut::<EXTENDED_HEX, UPPERCASE, STRICT_CASE>();
let hi_mask = select_hi_mask::<UPPERCASE, STRICT_CASE>();
let lo_mask = if EXTENDED_HEX {
&LO_MASK_HEX
} else {
&LO_MASK_STD
};
if let Some(index) = backend::validate_symbols(data, lut, hi_mask, lo_mask) {
return Err(backend::invalid_byte_error(data[index], index));
}
if plan.complete_len != plan.data_len {
let last = lut[usize::from(data[data.len() - 1])];
check_tail_bits(last, plan.data_len - plan.complete_len, plan.data_len - 1)?;
}
Ok(())
}

/// Encodes `input` into `output` using Base32, returning the number of bytes written.
#[inline]
pub fn encode<const EXTENDED_HEX: bool, const PADDED: bool, const UPPERCASE: bool>(
Expand Down Expand Up @@ -606,11 +650,7 @@ fn decode_tail<const EXTENDED_HEX: bool, const UPPERCASE: bool, const STRICT_CAS
[b0, b1] => {
let v0 = decode_value(*b0, base_index, lut)?;
let v1 = decode_value(*b1, base_index + 1, lut)?;
if v1 & 0x03 != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 1,
});
}
check_tail_bits(v1, trailing.len(), base_index + 1)?;
output[0].write((v0 << 3) | (v1 >> 2));
Ok(1)
}
Expand All @@ -619,11 +659,7 @@ fn decode_tail<const EXTENDED_HEX: bool, const UPPERCASE: bool, const STRICT_CAS
let v1 = decode_value(*b1, base_index + 1, lut)?;
let v2 = decode_value(*b2, base_index + 2, lut)?;
let v3 = decode_value(*b3, base_index + 3, lut)?;
if v3 & 0x0f != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 3,
});
}
check_tail_bits(v3, trailing.len(), base_index + 3)?;
output[0].write((v0 << 3) | (v1 >> 2));
output[1].write((v1 << 6) | (v2 << 1) | (v3 >> 4));
Ok(2)
Expand All @@ -634,11 +670,7 @@ fn decode_tail<const EXTENDED_HEX: bool, const UPPERCASE: bool, const STRICT_CAS
let v2 = decode_value(*b2, base_index + 2, lut)?;
let v3 = decode_value(*b3, base_index + 3, lut)?;
let v4 = decode_value(*b4, base_index + 4, lut)?;
if v4 & 0x01 != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 4,
});
}
check_tail_bits(v4, trailing.len(), base_index + 4)?;
output[0].write((v0 << 3) | (v1 >> 2));
output[1].write((v1 << 6) | (v2 << 1) | (v3 >> 4));
output[2].write((v3 << 4) | (v4 >> 1));
Expand All @@ -652,11 +684,7 @@ fn decode_tail<const EXTENDED_HEX: bool, const UPPERCASE: bool, const STRICT_CAS
let v4 = decode_value(*b4, base_index + 4, lut)?;
let v5 = decode_value(*b5, base_index + 5, lut)?;
let v6 = decode_value(*b6, base_index + 6, lut)?;
if v6 & 0x07 != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 6,
});
}
check_tail_bits(v6, trailing.len(), base_index + 6)?;
output[0].write((v0 << 3) | (v1 >> 2));
output[1].write((v1 << 6) | (v2 << 1) | (v3 >> 4));
output[2].write((v3 << 4) | (v4 >> 1));
Expand All @@ -667,6 +695,22 @@ fn decode_tail<const EXTENDED_HEX: bool, const UPPERCASE: bool, const STRICT_CAS
}
}

#[inline]
fn check_tail_bits(value: u8, tail_len: usize, index: usize) -> Result<(), DecodeError> {
let mask = match tail_len {
2 => 0x03,
4 => 0x0f,
5 => 0x01,
7 => 0x07,
_ => unreachable!("decode plan guarantees a valid tail length"),
};
if value & mask == 0 {
Ok(())
} else {
Err(DecodeError::NonCanonical { index })
}
}

fn find_invalid_in_quantum(quantum: &[u8], base_index: usize, lut: &[u8; 256]) -> DecodeError {
for (offset, &byte) in quantum.iter().enumerate() {
if lut[usize::from(byte)] & 0xe0 != 0 {
Expand Down
20 changes: 3 additions & 17 deletions bases/src/backend/base32/arch/aarch64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -58,19 +58,15 @@ use core::arch::aarch64::vst1q_u8;
use core::mem::MaybeUninit;
use core::ptr;

use crate::backend::base32::LO_MASK_HEX;
use crate::backend::base32::LO_MASK_STD;
use crate::backend::base32::select_alphabet;
use crate::backend::base32::select_hi_mask;

const W_SHUF: [u8; 16] = [1, 0, 2, 1, 3, 2, 4, 3, 6, 5, 7, 6, 8, 7, 9, 8];
const EVEN_SHIFTS: [i16; 8] = [-11, -9, -7, -5, -11, -9, -7, -5];
const ODD_SHIFTS: [i16; 8] = [2, 4, 6, 8, 2, 4, 6, 8];

const HI_MASK_MIXED: [u8; 16] = [0, 0, 0, 1, 2, 4, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_UPPER: [u8; 16] = [0, 0, 0, 1, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0, 0, 0];
const HI_MASK_LOWER: [u8; 16] = [0, 0, 0, 1, 0, 0, 2, 4, 0, 0, 0, 0, 0, 0, 0, 0];

const LO_MASK_STD: [u8; 16] = [4, 6, 7, 7, 7, 7, 7, 7, 6, 6, 6, 2, 2, 2, 2, 2];
const LO_MASK_HEX: [u8; 16] = [5, 7, 7, 7, 7, 7, 7, 3, 3, 3, 2, 2, 2, 2, 2, 2];

const ROLL_STD: [u8; 16] = [
0, 0, 0, 0xe8, 0xbf, 0xbf, 0x9f, 0x9f, 0, 0, 0, 0, 0, 0, 0, 0,
];
Expand All @@ -80,16 +76,6 @@ const ROLL_HEX: [u8; 16] = [

const PACK_SHUF: [u8; 16] = [4, 3, 2, 1, 0, 12, 11, 10, 9, 8, 0, 0, 0, 0, 0, 0];

const fn select_hi_mask<const UPPERCASE: bool, const STRICT_CASE: bool>() -> &'static [u8; 16] {
if !STRICT_CASE {
&HI_MASK_MIXED
} else if UPPERCASE {
&HI_MASK_UPPER
} else {
&HI_MASK_LOWER
}
}

#[inline]
pub fn encode<const EXTENDED_HEX: bool, const UPPERCASE: bool>(
input: &[u8],
Expand Down
56 changes: 46 additions & 10 deletions bases/src/backend/base64.rs
Original file line number Diff line number Diff line change
Expand Up @@ -33,6 +33,14 @@ const URL_DECODE_LUTS: [[i32; 256]; 4] = make_decode_luts(true);
const STD_DECODE_BYTE_LUT: [u8; 256] = make_decode_byte_lut(false);
const URL_DECODE_BYTE_LUT: [u8; 256] = make_decode_byte_lut(true);

pub const HI_MASK: [u8; 16] = [0, 0, 1, 2, 4, 8, 4, 16, 0, 0, 0, 0, 0, 0, 0, 0];
pub const LO_MASK_STD: [u8; 16] = [
0x1a, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c, 0x05, 0x04, 0x04, 0x04, 0x05,
];
pub const LO_MASK_URL: [u8; 16] = [
0x1a, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1e, 0x1c, 0x04, 0x04, 0x05, 0x04, 0x0c,
];

const fn make_decode_luts(url_safe: bool) -> [[i32; 256]; 4] {
let mut luts = [[-1_i32; 256]; 4];
let alphabet = if url_safe { URL_SAFE } else { STANDARD };
Expand Down Expand Up @@ -149,6 +157,28 @@ pub fn decode_plan<const PADDED: bool>(input: &[u8]) -> Result<DecodePlan, Decod
}
}

/// Validates Base64 alphabet symbols and unused trailing bits using `plan`.
#[inline]
pub fn validate_with_plan<const URL_SAFE_ALPHABET: bool>(
input: &[u8],
plan: DecodePlan,
) -> Result<(), DecodeError> {
let data = &input[..plan.data_len];
let (lut, lo_mask) = if URL_SAFE_ALPHABET {
(&URL_DECODE_BYTE_LUT, &LO_MASK_URL)
} else {
(&STD_DECODE_BYTE_LUT, &LO_MASK_STD)
};
if let Some(index) = backend::validate_symbols(data, lut, &HI_MASK, lo_mask) {
return Err(backend::invalid_byte_error(data[index], index));
}
if plan.complete_len != plan.data_len {
let last = lut[usize::from(data[data.len() - 1])];
check_tail_bits(last, plan.data_len - plan.complete_len, plan.data_len - 1)?;
}
Ok(())
}

/// Encodes `input` into `output` using Base64, returning the number of bytes written.
#[inline]
pub fn encode<const URL_SAFE_ALPHABET: bool, const PADDED: bool>(
Expand Down Expand Up @@ -611,23 +641,15 @@ fn decode_tail<const URL_SAFE_ALPHABET: bool>(
[first, second] => {
let v0 = decode_value(*first, base_index, lut)?;
let v1 = decode_value(*second, base_index + 1, lut)?;
if v1 & 0x0f != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 1,
});
}
check_tail_bits(v1, trailing.len(), base_index + 1)?;
output[0].write((v0 << 2) | (v1 >> 4));
Ok(1)
}
[first, second, third] => {
let v0 = decode_value(*first, base_index, lut)?;
let v1 = decode_value(*second, base_index + 1, lut)?;
let v2 = decode_value(*third, base_index + 2, lut)?;
if v2 & 0x03 != 0 {
return Err(DecodeError::NonCanonical {
index: base_index + 2,
});
}
check_tail_bits(v2, trailing.len(), base_index + 2)?;
output[0].write((v0 << 2) | (v1 >> 4));
output[1].write((v1 << 4) | (v2 >> 2));
Ok(2)
Expand All @@ -636,6 +658,20 @@ fn decode_tail<const URL_SAFE_ALPHABET: bool>(
}
}

#[inline]
fn check_tail_bits(value: u8, tail_len: usize, index: usize) -> Result<(), DecodeError> {
let mask = match tail_len {
2 => 0x0f,
3 => 0x03,
_ => unreachable!("decode plan guarantees a valid tail length"),
};
if value & mask == 0 {
Ok(())
} else {
Err(DecodeError::NonCanonical { index })
}
}

#[inline]
fn find_invalid_in_slice(slice: &[u8], base_index: usize, lut: &[u8; 256]) -> DecodeError {
for (offset, &byte) in slice.iter().enumerate() {
Expand Down
Loading
Loading