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.

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

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
Lines240:4–250:5
Program versionRevised program