Source context

Program Rust

right_shift_loop1

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

207             return;208         }209         let mask = (1_u64 << shift) - 1;210         while read_index < self.num_digits {211             let new_digit = (n >> shift) as u8;212             n = (10 * (n & mask)) + self.digits[read_index] as u64;213             read_index += 1;214             self.digits[write_index] = new_digit;215             write_index += 1;216         }217         while n > 0 {218             let new_digit = (n >> shift) as u8;219             n = 10 * (n & mask);

Aeneas declaration

The Lean below was mechanically extracted by Aeneas from Rust.

@[rust_loop]
def num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1
  (i : Std.Usize) (a : Array Std.U8 768#usize) (shift : Std.Usize)
  (read_index : Std.Usize) (write_index : Std.Usize) (n : Std.U64)
  (mask : Std.U64) :
  Result ((Array Std.U8 768#usize) × Std.Usize × Std.U64)
  := do
  loop
    (fun (a1, read_index1, write_index1, n1) =>
      num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1.body i shift
      mask a1 read_index1 write_index1 n1)
    (a, read_index, write_index, n)
Operations used here

body · Program Rust

Other extracted objects at this span

num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1.body

Source details
Declarationnum.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1
Filenum/imp/../../dec2flt/decimal_seq.rs
Lines210:8–216:9
Program versionRevised program