Rollup merge of #126271 - diondokter:dec2flt-skip-fast-path, r=tgross35

Skip fast path for dec2flt when optimize_for_size

Tracking issue: https://github.com/rust-lang/rust/issues/125612

Skip the fast algorithm when optimizing for size.
When compiling for https://github.com/quartiq/stabilizer I get these numbers:

Before
```
   text    data     bss     dec     hex filename
 192192       8   49424  241624   3afd8 dual-iir
```

After
```
   text    data     bss     dec     hex filename
 191632       8   49424  241064   3ada8 dual-iir
```

This saves 560 bytes.
This commit is contained in:
Trevor Gross 2024-07-16 20:10:09 -05:00 committed by GitHub
commit fe1dc02163
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
1 changed files with 4 additions and 2 deletions

View File

@ -250,8 +250,10 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
None => return Err(pfe_invalid()),
};
num.negative = negative;
if let Some(value) = num.try_fast_path::<F>() {
return Ok(value);
if !cfg!(feature = "optimize_for_size") {
if let Some(value) = num.try_fast_path::<F>() {
return Ok(value);
}
}
// If significant digits were truncated, then we can have rounding error