Skip to content
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.

Commit d49abe1

Browse files
authoredJul 17, 2024
Unrolled build for rust-lang#126271
Rollup merge of rust-lang#126271 - diondokter:dec2flt-skip-fast-path, r=tgross35 Skip fast path for dec2flt when optimize_for_size Tracking issue: rust-lang#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.
2 parents 1a6e777 + 33f1d9d commit d49abe1

File tree

1 file changed

+4
-2
lines changed
  • library/core/src/num/dec2flt

1 file changed

+4
-2
lines changed
 

‎library/core/src/num/dec2flt/mod.rs

+4-2
Original file line numberDiff line numberDiff line change
@@ -250,8 +250,10 @@ pub fn dec2flt<F: RawFloat>(s: &str) -> Result<F, ParseFloatError> {
250250
None => return Err(pfe_invalid()),
251251
};
252252
num.negative = negative;
253-
if let Some(value) = num.try_fast_path::<F>() {
254-
return Ok(value);
253+
if !cfg!(feature = "optimize_for_size") {
254+
if let Some(value) = num.try_fast_path::<F>() {
255+
return Ok(value);
256+
}
255257
}
256258

257259
// If significant digits were truncated, then we can have rounding error

0 commit comments

Comments
 (0)
Failed to load comments.