From cd61547b63d72aa645e6e72a8d56cdd071a78232 Mon Sep 17 00:00:00 2001 From: IRainman Date: Tue, 30 Dec 2025 00:11:16 +0300 Subject: [PATCH] FASTFLOAT_HAS_BIT_CAST fix for old standards. --- include/fast_float/float_common.h | 7 +++++-- 1 file changed, 5 insertions(+), 2 deletions(-) diff --git a/include/fast_float/float_common.h b/include/fast_float/float_common.h index 6e51143..7191b04 100644 --- a/include/fast_float/float_common.h +++ b/include/fast_float/float_common.h @@ -251,11 +251,14 @@ using parse_options = parse_options_t; #endif namespace fast_float { +#if FASTFLOAT_HAS_BIT_CAST template fastfloat_really_inline constexpr To bit_cast(const From &from) noexcept { -#if FASTFLOAT_HAS_BIT_CAST return std::bit_cast(from); +} #else +template +fastfloat_really_inline To bit_cast(const From &from) noexcept { // Implementation of std::bit_cast for pre-C++20. static_assert(sizeof(To) == sizeof(From), "bit_cast requires source and destination to be the same size"); @@ -263,8 +266,8 @@ fastfloat_really_inline constexpr To bit_cast(const From &from) noexcept { // The cast suppresses a bogus -Wclass-memaccess on GCC. std::memcpy(static_cast(&to), &from, sizeof(to)); return to; -#endif } +#endif fastfloat_really_inline constexpr bool cpp20_and_in_constexpr() noexcept { #if FASTFLOAT_HAS_IS_CONSTANT_EVALUATED