Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor.
(data: &[u8], cursor: &mut usize)
| 162 | |
| 163 | /// Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor. |
| 164 | fn read_u32(data: &[u8], cursor: &mut usize) -> Option<u32> { |
| 165 | let end = *cursor + 4; |
| 166 | if end > data.len() { |
| 167 | return None; |
| 168 | } |
| 169 | let bytes: [u8; 4] = data[*cursor..end].try_into().ok()?; |
| 170 | *cursor = end; |
| 171 | Some(u32::from_le_bytes(bytes)) |
| 172 | } |
| 173 | |
| 174 | /// Read a little-endian `u16` from `data` at `*cursor`, advancing the cursor. |
| 175 | fn read_u16(data: &[u8], cursor: &mut usize) -> Option<u16> { |