MCPcopy Index your code
hub / github.com/encounter/objdiff / read_u32

Function read_u32

objdiff-core/src/obj/mdebug.rs:389–397  ·  view source on GitHub ↗
(data: &[u8], cursor: &mut usize, endianness: Endianness)

Source from the content-addressed store, hash-verified

387}
388
389fn read_u32(data: &[u8], cursor: &mut usize, endianness: Endianness) -> Result<u32> {
390 ensure!(*cursor + 4 <= data.len(), "unexpected EOF while reading u32");
391 let bytes: [u8; 4] = data[*cursor..*cursor + 4].try_into().unwrap();
392 *cursor += 4;
393 Ok(match endianness {
394 Endianness::Big => u32::from_be_bytes(bytes),
395 Endianness::Little => u32::from_le_bytes(bytes),
396 })
397}
398
399fn read_i32(data: &[u8], cursor: &mut usize, endianness: Endianness) -> Result<i32> {
400 Ok(read_u32(data, cursor, endianness)? as i32)

Callers 4

parse_line_info_dwarf1Function · 0.70
parseMethod · 0.70
parse_symbolsFunction · 0.70
read_i32Function · 0.70

Calls

no outgoing calls

Tested by

no test coverage detected