From 37e301d310f883f673effa882221aaaa2d05e235 Mon Sep 17 00:00:00 2001 From: Matt Borland Date: Thu, 19 Jan 2023 12:17:07 -0800 Subject: [PATCH] Fix for warning C4244 --- include/boost/charconv/to_chars.hpp | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/include/boost/charconv/to_chars.hpp b/include/boost/charconv/to_chars.hpp index 6bae33f..1281f43 100644 --- a/include/boost/charconv/to_chars.hpp +++ b/include/boost/charconv/to_chars.hpp @@ -113,9 +113,10 @@ BOOST_CXX14_CONSTEXPR to_chars_result to_chars_integer_impl(char* first, char* l if (std::numeric_limits::digits <= std::numeric_limits::digits || value <= static_cast((std::numeric_limits::max)())) { - const auto num_sig_chars = num_digits(value); + const auto converted_value = static_cast(value); + const auto num_sig_chars = num_digits(converted_value); - decompose32(value, buffer); + decompose32(converted_value, buffer); // TODO: If constant evaluated use unrolled loop // If not constant evaluated use memcpy