Source context

Program Rust

count_trailing_zeros_loop

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

236     let mut n_trailing_zeros = 0;237     let mut i = consumed_len;238     let mut scanning = true;239     while i != 0 && scanning {240         let c = start[i - 1];241         if c == b'0' || c == b'.' {242             i -= 1;243             if c == b'0' {244                 n_trailing_zeros += 1;245             }246         } else {247             scanning = false;248         }249     }250     n_trailing_zeros251 }252 

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.decimal_seq.count_trailing_zeros_loop
  (start : Slice Std.U8) (n_trailing_zeros : Std.Usize) (i : Std.Usize)
  (scanning : Bool) :
  Result Std.Usize
  := do
  loop
    (fun (n_trailing_zeros1, i1, scanning1) =>
      num.imp.dec2flt.decimal_seq.count_trailing_zeros_loop.body start
      n_trailing_zeros1 i1 scanning1)
    (n_trailing_zeros, i, scanning)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.count_trailing_zeros_loop.body

Source details
Declarationnum.imp.dec2flt.decimal_seq.count_trailing_zeros_loop
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines239:4–249:5
Program versionOriginal program