(input: &mut Vec<u8>, x: &[u8], offset: usize)
| 106 | } |
| 107 | |
| 108 | pub fn insert_slice(input: &mut Vec<u8>, x: &[u8], offset: usize) { |
| 109 | let position = offset..((offset + x.len()).min(input.len())); |
| 110 | input.resize(input.len() + x.len(), 0); |
| 111 | input.copy_within(position, offset + x.len()); |
| 112 | input[offset..offset + x.len()].copy_from_slice(x); |
| 113 | } |
| 114 | |
| 115 | pub fn insert_slice_strided(input: &mut Vec<u8>, x: &[u8], offset: usize, stride: usize) { |
| 116 | let len = x.len() * stride; |