MCPcopy Create free account
hub / github.com/PHPantom-dev/phpantom_lsp / read_u32

Function read_u32

src/phar.rs:164–172  ·  view source on GitHub ↗

Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor.

(data: &[u8], cursor: &mut usize)

Source from the content-addressed store, hash-verified

162
163/// Read a little-endian `u32` from `data` at `*cursor`, advancing the cursor.
164fn 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.
175fn read_u16(data: &[u8], cursor: &mut usize) -> Option<u16> {

Callers 1

parseMethod · 0.85

Calls

no outgoing calls

Tested by

no test coverage detected