Source context

Program Rust

body

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

304                 s = &s[1..];305             }306         }307         while s.len() >= 8 && d.num_digits + 8 < DecimalSeq::MAX_DIGITS {308             let v = s.read_u64();309             if !is_8digits(v) {310                 break;311             }312             d.digits[d.num_digits..].write_u64(v - 0x3030_3030_3030_3030);313             d.num_digits += 8;314             s = &s[8..];315         }316         s = parse_digits_into_seq(s, &mut d);317         d.decimal_point = s.len() as i32 - first.len() as i32;318     }

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop_body]
def num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop5.body
  (s : Slice Std.U8) (i : Std.Usize) (a : Array Std.U8 768#usize) :
  Result (ControlFlow ((Slice Std.U8) × Std.Usize × (Array Std.U8 768#usize))
    ((Slice Std.U8) × Std.Usize × (Array Std.U8 768#usize)))
  := do
  let i1 := Slice.len s
  if i1 >= 8#usize
  then
    let i2 ← i + 8#usize
    if i2 < num.imp.dec2flt.decimal_seq.DecimalSeq.MAX_DIGITS
    then
      let v ←
        SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.read_u64 s
      let b ← num.imp.dec2flt.common.is_8digits v
      if b
      then
        let (s1, index_mut_back) ←
          core.array.Array.index_mut (core.ops.index.IndexMutSlice
            (core.slice.index.SliceIndexRangeFromUsizeSlice Std.U8)) a
            { start := i }
        let i3 ← v - 3472328296227680304#u64
        let s2 ←
          SliceU8.Insts.Dec2flt_modelNumImpDec2fltCommonByteSlice.write_u64 s1
            i3
        let s3 ←
          core.slice.index.Slice.index
            (core.slice.index.SliceIndexRangeFromUsizeSlice Std.U8) s
            { start := 8#usize }
        let a1 := index_mut_back s2
        ok (cont (s3, i2, a1))
      else ok (done (s, i, a))
    else ok (done (s, i, a))
  else ok (done (s, i, a))
Operations used here

write_u64 · Program Rust

read_u64 · Program Rust

is_8digits · Program Rust

MAX_DIGITS · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop3.body

num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop3

num.imp.dec2flt.decimal_seq.parse_decimal_seq_loop5

Source details
Declarationnum.imp.dec2flt.decimal_seq.parse_decimal_seq_loop5.body
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines307:8–315:9
Program versionOriginal program