Program Rust
Dec2flt_modelNumImpDec2fltCommonByteSlice
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
17 18 }19 20 impl ByteSlice for [u8] {21 #[inline(always)] // inlining this is crucial to remove bound checks22 fn read_u64(&self) -> u64 {23 let mut tmp = [0; 8];24 tmp.copy_from_slice(&self[..8]);25 u64::from_le_bytes(tmp)26 }27 28 #[inline(always)] // inlining this is crucial to remove bound checks29 fn write_u64(&mut self, value: u64) {30 self[..8].copy_from_slice(&value.to_le_bytes())31 }32 33 #[inline]34 fn offset_from(&self, other: &Self) -> isize {35 other.len() as isize - self.len() as isize36 }37 38 }39 40 /// Determine if all characters in an 8-byte byte string (represented as a `u64`) are all decimal41 /// digits.Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
@[reducible]
def SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice :
num.imp.dec2flt.common.ByteSlice (Slice Std.U8) := {
read_u64 := SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.read_u64
write_u64 :=
SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.write_u64
offset_from :=
SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.offset_from
}Operations used here
Source details
| Declaration | SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice |
|---|---|
| File | num/imp/../../dec2flt/common.rs |
| Lines | 20:0–38:1 |
| Program version | Revised program |