Skip to main content

encode_helper

Function encode_helper 

Source
pub(crate) fn encode_helper(
    encode_table: &[u8; 64],
    input: &[u8],
    output: &mut [u8],
    simd_prefix: impl FnOnce(&[u8], &mut [u8]) -> (usize, usize),
) -> usize
Expand description

Scalar base64 encode of input into output, returning the number of bytes written.

simd_prefix gets first crack at the input, returning (input_consumed, output_written). It must consume whole 3-byte groups: input_consumed % 3 == 0, output_written == input_consumed / 3 * 4, both in bounds, and only those output_written bytes are written. (0, 0) (pure scalar) is always valid.