| 89 | |
| 90 | impl<'a> View<'a> for F32Decoder<'a> { |
| 91 | fn populate(&mut self, input: &mut &'a [u8], length: usize) -> Result<()> { |
| 92 | let total: &[u8] = bytemuck::must_cast_slice(consume_byte_arrays::<4>(input, length)?); |
| 93 | let (mantissa, sign_exp) = total.split_at(length * 3); |
| 94 | let mantissa: &[[u8; 3]] = bytemuck::cast_slice(mantissa); |
| 95 | // Equivalent to `mantissa.into()` but satisfies miri when we read extra in decode. |
| 96 | self.mantissa = |
| 97 | unsafe { FastSlice::from_raw_parts(total.as_ptr() as *const [u8; 3], mantissa.len()) }; |
| 98 | self.sign_exp = sign_exp.into(); |
| 99 | Ok(()) |
| 100 | } |
| 101 | } |
| 102 | |
| 103 | impl<'a> Decoder<'a, f32> for F32Decoder<'a> { |