From 019e01f23f5bb86913246ccc94b40ccb5eb482e6 Mon Sep 17 00:00:00 2001 From: Dion Dokter Date: Tue, 11 Jun 2024 13:24:35 +0200 Subject: [PATCH 1/2] Skip fast path for dec2flt when optimize_for_size --- core/src/num/dec2flt/mod.rs | 6 ++++-- 1 file changed, 4 insertions(+), 2 deletions(-) diff --git a/core/src/num/dec2flt/mod.rs b/core/src/num/dec2flt/mod.rs index a4bc8b1c9b0c3..c10bf797b57f1 100644 --- a/core/src/num/dec2flt/mod.rs +++ b/core/src/num/dec2flt/mod.rs @@ -250,8 +250,10 @@ pub fn dec2flt(s: &str) -> Result { None => return Err(pfe_invalid()), }; num.negative = negative; - if let Some(value) = num.try_fast_path::() { - return Ok(value); + if cfg!(not(feature = "optimize_for_size")) { + if let Some(value) = num.try_fast_path::() { + return Ok(value); + } } // If significant digits were truncated, then we can have rounding error From 32a1b078ba491a77d9f2700694946b98745b0af0 Mon Sep 17 00:00:00 2001 From: Dion Dokter Date: Wed, 17 Jul 2024 01:20:56 +0200 Subject: [PATCH 2/2] Cfg nit Co-authored-by: Clar Fon <15850505+clarfonthey@users.noreply.github.com> --- core/src/num/dec2flt/mod.rs | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/core/src/num/dec2flt/mod.rs b/core/src/num/dec2flt/mod.rs index c10bf797b57f1..9aac2332dce0d 100644 --- a/core/src/num/dec2flt/mod.rs +++ b/core/src/num/dec2flt/mod.rs @@ -250,7 +250,7 @@ pub fn dec2flt(s: &str) -> Result { None => return Err(pfe_invalid()), }; num.negative = negative; - if cfg!(not(feature = "optimize_for_size")) { + if !cfg!(feature = "optimize_for_size") { if let Some(value) = num.try_fast_path::() { return Ok(value); }