From 10207f024684bb1c85a8d0b8f96c506e24fe07e7 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 21 Nov 2024 21:53:57 -0500 Subject: [PATCH 1/4] When fetching fast_float, use version 7.0.0 --- cmake/dependencies.cmake | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/cmake/dependencies.cmake b/cmake/dependencies.cmake index 689110b6..a1efa411 100644 --- a/cmake/dependencies.cmake +++ b/cmake/dependencies.cmake @@ -111,7 +111,7 @@ else () FetchContent_Declare( fast_float GIT_REPOSITORY https://github.com/fastfloat/fast_float.git - GIT_TAG v6.1.6 + GIT_TAG v7.0.0 GIT_SHALLOW TRUE ) From 385721ea40d0ec7955fbed80ed246dd1cae67b20 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Thu, 21 Nov 2024 18:26:12 -0500 Subject: [PATCH 2/4] Fix compatibility with `chars_format` in fast_float version 7 This release changes `chars_format` from an `enum` to an `enum class` with underlying type `uint64_t`. https://github.com/fastfloat/fast_float/releases/tag/v7.0.0 --- src/scn/impl.cpp | 8 +++++--- 1 file changed, 5 insertions(+), 3 deletions(-) diff --git a/src/scn/impl.cpp b/src/scn/impl.cpp index aa0d3343..2ad35ffc 100644 --- a/src/scn/impl.cpp +++ b/src/scn/impl.cpp @@ -721,12 +721,14 @@ scan_expected fast_float_fallback(impl_init_data data, struct fast_float_impl_base : impl_base { fast_float::chars_format get_flags() const { - unsigned format_flags{}; + uint64_t format_flags{}; if ((m_options & float_reader_base::allow_fixed) != 0) { - format_flags |= fast_float::fixed; + format_flags |= + static_cast(fast_float::chars_format::fixed); } if ((m_options & float_reader_base::allow_scientific) != 0) { - format_flags |= fast_float::scientific; + format_flags |= + static_cast(fast_float::chars_format::scientific); } return static_cast(format_flags); From 4c38f4eb31afe4c7f418caa3aa4a534ddc619be8 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Fri, 22 Nov 2024 12:28:25 -0500 Subject: [PATCH 3/4] =?UTF-8?q?Avoid=20having=20to=20name=20a=20type=20for?= =?UTF-8?q?=20or=E2=80=99ing=20`chars=5Fformat`=20flags?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit See https://github.com/eliaskosunen/scnlib/issues/135#issuecomment-2493883319. --- src/scn/impl.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/scn/impl.cpp b/src/scn/impl.cpp index 2ad35ffc..ab859a41 100644 --- a/src/scn/impl.cpp +++ b/src/scn/impl.cpp @@ -721,17 +721,17 @@ scan_expected fast_float_fallback(impl_init_data data, struct fast_float_impl_base : impl_base { fast_float::chars_format get_flags() const { - uint64_t format_flags{}; + fast_float::chars_format format_flags{}; if ((m_options & float_reader_base::allow_fixed) != 0) { - format_flags |= - static_cast(fast_float::chars_format::fixed); + format_flags = + static_cast(format_flags | fast_float::chars_format::fixed); } if ((m_options & float_reader_base::allow_scientific) != 0) { - format_flags |= - static_cast(fast_float::chars_format::scientific); + format_flags = + static_cast(format_flags | fast_float::chars_format::scientific); } - return static_cast(format_flags); + return format_flags; } }; From 8c53bc3653fe9081a8a68f2bb7f587aee733be48 Mon Sep 17 00:00:00 2001 From: "Benjamin A. Beasley" Date: Sat, 30 Nov 2024 10:32:23 -0500 Subject: [PATCH 4/4] Do not attempt to benchmark fast_float with long double This type is not supported in fast_float: https://github.com/fastfloat/fast_float/issues/88. As of fast_float 7.0.0, trying to parse long doubles with fast_float results in a compiler error rather than selecting the wrong overload: https://github.com/eliaskosunen/scnlib/issues/135#issuecomment-2493873042. --- benchmark/runtime/float/repeated.cpp | 1 - benchmark/runtime/float/single.cpp | 1 - 2 files changed, 2 deletions(-) diff --git a/benchmark/runtime/float/repeated.cpp b/benchmark/runtime/float/repeated.cpp index 0aa0c39a..8a4de0a1 100644 --- a/benchmark/runtime/float/repeated.cpp +++ b/benchmark/runtime/float/repeated.cpp @@ -210,4 +210,3 @@ static void scan_float_repeated_fastfloat(benchmark::State& state) } BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, float); BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, double); -BENCHMARK_TEMPLATE(scan_float_repeated_fastfloat, long double); diff --git a/benchmark/runtime/float/single.cpp b/benchmark/runtime/float/single.cpp index e06cd138..6819621b 100644 --- a/benchmark/runtime/float/single.cpp +++ b/benchmark/runtime/float/single.cpp @@ -185,4 +185,3 @@ static void scan_float_single_fastfloat(benchmark::State& state) } BENCHMARK_TEMPLATE(scan_float_single_fastfloat, float); BENCHMARK_TEMPLATE(scan_float_single_fastfloat, double); -BENCHMARK_TEMPLATE(scan_float_single_fastfloat, long double);