| 389 | #[inline] |
| 390 | #[allow(clippy::arithmetic_side_effects)] |
| 391 | fn word_to_slice<T>(word: Word, out: &mut [T]) |
| 392 | where |
| 393 | T: BitOrAssign + Copy + From<u8> + Shl<usize, Output = T>, |
| 394 | { |
| 395 | debug_assert!(size_of::<T>() > 0, "can't be used with ZSTs"); |
| 396 | debug_assert!(out.len() <= WORD_SIZE, "slice too large"); |
| 397 | |
| 398 | let bytes = word.to_le_bytes(); |
| 399 | for (o, chunk) in out.iter_mut().zip(bytes.chunks(size_of::<T>())) { |
| 400 | *o = T::from(0u8); |
| 401 | for (i, &byte) in chunk.iter().enumerate() { |
| 402 | *o |= T::from(byte) << (i * 8); |
| 403 | } |
| 404 | } |
| 405 | } |
| 406 | |
| 407 | // |
| 408 | // Vendored `core` functions to allow a 1.85 MSRV |