From 9d2891fae6fd1d9bfe0de4ad96f94c43f4bf80a5 Mon Sep 17 00:00:00 2001 From: Niels Lohmann Date: Thu, 15 Oct 2026 19:39:04 +0200 Subject: [PATCH] Fix CI: cast the 128-bit unsigned value explicitly in the integer fast path The up-to-16-digit fast path from develop assigned number_unsigned_t to std::uint64_t implicitly, which -Wconversion rejects for __int128. Signed-off-by: Niels Lohmann --- include/nlohmann/detail/output/serializer.hpp | 2 +- single_include/nlohmann/json.hpp | 2 +- 2 files changed, 2 insertions(+), 2 deletions(-) diff --git a/include/nlohmann/detail/output/serializer.hpp b/include/nlohmann/detail/output/serializer.hpp index 9a8203695..93929c35b 100644 --- a/include/nlohmann/detail/output/serializer.hpp +++ b/include/nlohmann/detail/output/serializer.hpp @@ -1430,7 +1430,7 @@ class serializer // without leading zeros if (abs_value < 10000000000000000u) { - const std::uint64_t value = abs_value; + const auto value = static_cast(abs_value); // fits: abs_value < 10^16 const std::uint64_t upper = value / 100000000u; const std::uint64_t first = dtoa_impl::eight_digit_bytes(upper != 0 ? upper : value); const auto leading = static_cast(count_leading_zeros(first) / 8); // (first is not 0) diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index df02c065c..54af5b5ce 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -28951,7 +28951,7 @@ class serializer // without leading zeros if (abs_value < 10000000000000000u) { - const std::uint64_t value = abs_value; + const auto value = static_cast(abs_value); // fits: abs_value < 10^16 const std::uint64_t upper = value / 100000000u; const std::uint64_t first = dtoa_impl::eight_digit_bytes(upper != 0 ? upper : value); const auto leading = static_cast(count_leading_zeros(first) / 8); // (first is not 0)