Program Rust
parse_decimal_exponent_loop
This Rust is the input prepared for Aeneas. Modeling choices explains the adaptations from the production source.
269 fn parse_decimal_exponent(s: &[u8]) -> i32 {270 let mut exp_num = 0;271 let mut count = 0;272 while count < s.len() && s[count].wrapping_sub(b'0') < 10 {273 let digit = s[count].wrapping_sub(b'0');274 if exp_num < 0x10000 {275 exp_num = 10 * exp_num + digit as i32;276 }277 count += 1;278 }279 exp_num280 }281 Aeneas declaration
The Lean below was mechanically extracted by Aeneas from Rust.
@[rust_loop]
def num.imp.dec2flt.decimal_seq.parse_decimal_exponent_loop
(s : Slice Std.U8) (exp_num : Std.I32) (count : Std.Usize) :
Result Std.I32
:= do
loop
(fun (exp_num1, count1) =>
num.imp.dec2flt.decimal_seq.parse_decimal_exponent_loop.body s exp_num1
count1)
(exp_num, count)Operations used here
Other extracted objects at this span
num.imp.dec2flt.decimal_seq.parse_decimal_exponent_loop.body
Source details
| Declaration | num.imp.dec2flt.decimal_seq.parse_decimal_exponent_loop |
|---|---|
| File | num/imp/../../dec2flt/decimal_seq.rs |
| Lines | 272:4–278:5 |
| Program version | Preparation 1 |