pub unsafe fn interleave_unchecked<T: Copy, Vin: AsRef<[T]>, const CHANNELS: usize>(
input: &[Vin],
input_range: Range<usize>,
output: &mut [T],
)Expand description
Interleave the given channels into the output buffer.
No bounds checking will occur.
input- The de-interleaved input channels.input_range- The range in each input channel to read from.output- The interleaved output buffer to write to.
§Example
let input: Vec<Vec<i32>> = vec![vec![1, 3, 5, 7], vec![2, 4, 6, 8]];
let mut output: Vec<i32> = vec![0; 8];
unsafe { interleave_unchecked::<_, _, 2>(&input, 0..4, &mut output); }
assert_eq!(&output, &[1, 2, 3, 4, 5, 6, 7, 8]);
// Interleave range in input:
unsafe { interleave_unchecked::<_, _, 2>(&input, 2..4, &mut output[0..4]); }
assert_eq!(&output, &[5, 6, 7, 8, 5, 6, 7, 8]);§Safety
The caller must uphold that all of the following conditions are true:
input.len() >= CHANNELSinput_rangeis within bounds for every input channeloutput.len() >= (input_range.end - input_range.start) * CHANNELSCHANNELS> 0