| 237 | #[inline(always)] |
| 238 | #[must_use] |
| 239 | pub fn into_chunks<N: ArraySize>( |
| 240 | self, |
| 241 | ) -> (InOutBuf<'inp, 'out, Array<T, N>>, InOutBuf<'inp, 'out, T>) { |
| 242 | let chunks = self.len() / N::USIZE; |
| 243 | let tail_pos = N::USIZE * chunks; |
| 244 | let tail_len = self.len() - tail_pos; |
| 245 | unsafe { |
| 246 | let chunks = InOutBuf { |
| 247 | in_ptr: self.in_ptr.cast::<Array<T, N>>(), |
| 248 | out_ptr: self.out_ptr.cast::<Array<T, N>>(), |
| 249 | len: chunks, |
| 250 | _pd: PhantomData, |
| 251 | }; |
| 252 | let tail = InOutBuf { |
| 253 | in_ptr: self.in_ptr.add(tail_pos), |
| 254 | out_ptr: self.out_ptr.add(tail_pos), |
| 255 | len: tail_len, |
| 256 | _pd: PhantomData, |
| 257 | }; |
| 258 | (chunks, tail) |
| 259 | } |
| 260 | } |
| 261 | } |
| 262 | |
| 263 | impl InOutBuf<'_, '_, u8> { |