Program Rust
read_u64
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
15 16 impl ByteSlice for [u8] {17 #[inline(always)] // inlining this is crucial to remove bound checks18 fn read_u64(&self) -> u64 {19 let mut tmp = [0; 8];20 tmp.copy_from_slice(&self[..8]);21 u64::from_le_bytes(tmp)22 }23 24 #[inline(always)] // inlining this is crucial to remove bound checks25 fn write_u64(&mut self, value: u64) {Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
def SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.read_u64
(self : Slice Std.U8) : Result Std.U64 := do
let tmp := Array.repeat 8#usize 0#u8
let (s, to_slice_mut_back) ← lift (Array.to_slice_mut tmp)
let s1 ←
core.slice.index.Slice.index (core.slice.index.SliceIndexRangeToUsizeSlice
Std.U8) self { «end» := 8#usize }
let s2 ← core.slice.Slice.copy_from_slice core.marker.CopyU8 s s1
let tmp1 := to_slice_mut_back s2
ok (core.num.U64.from_le_bytes tmp1)Source details
| Declaration | SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.read_u64 |
|---|---|
| File | num/imp/../../dec2flt/common.rs |
| Lines | 18:4–22:5 |
| Program version | Original program |