Program Rust
right_shift_loop1
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
206 return;207 }208 let mask = (1_u64 << shift) - 1;209 while read_index < self.num_digits {210 let new_digit = (n >> shift) as u8;211 n = (10 * (n & mask)) + self.digits[read_index] as u64;212 read_index += 1;213 self.digits[write_index] = new_digit;214 write_index += 1;215 }216 while n > 0 {217 let new_digit = (n >> shift) as u8;218 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
Other extracted objects at this span
num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1.body
Source details
| Declaration | num.imp.dec2flt.decimal_seq.DecimalSeq.right_shift_loop1 |
|---|---|
| File | num/imp/../../dec2flt/decimal_seq.rs |
| Lines | 209:8–215:9 |
| Program version | Original program |