Source context

Program Rust

Dec2flt_modelNumImpDec2fltCommonByteSlice

This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.

13 14 }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) {26         self[..8].copy_from_slice(&value.to_le_bytes())27     }28 29     #[inline]30     fn offset_from(&self, other: &Self) -> isize {31         other.len() as isize - self.len() as isize32     }33 34 }35 36 /// Determine if all characters in an 8-byte byte string (represented as a `u64`) are all decimal37 /// 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

ByteSlice · Program Rust

offset_from · Program Rust

write_u64 · Program Rust

read_u64 · Program Rust

Source details
DeclarationSliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice
Filenum/imp/../../dec2flt/common.rs
Lines16:0–34:1
Program versionOriginal program