This test performs the equivalent of subslicing a slice through unsafe code and avoids the bounds checking:
let hashtab: &[u8] = unsafe {
let addr = base.as_ptr().add(hash_section.sh_offset as usize);
let size = hash_section.sh_size as usize;
slice::from_raw_parts(addr, size)
};
Since it's a test, I expect the bounds checking to not matter (I also expect that any potential overhead is dwarfed by everything else this function is doing like the vec allocation or the Elf parsing)
This test performs the equivalent of subslicing a slice through unsafe code and avoids the bounds checking:
Since it's a test, I expect the bounds checking to not matter (I also expect that any potential overhead is dwarfed by everything else this function is doing like the vec allocation or the Elf parsing)