diff --git a/include/fast_float/ascii_number.h b/include/fast_float/ascii_number.h index 219c7d3..15a8a20 100644 --- a/include/fast_float/ascii_number.h +++ b/include/fast_float/ascii_number.h @@ -529,8 +529,8 @@ from_chars_result_t parse_int_string(UC const* p, UC const* pend, T& value, // this weird workaround is required because: // - converting unsigned to signed when its value is greater than signed max is UB pre-C++23. // - reinterpret_casting (~i + 1) would work, but it is not constexpr - // this is always optimized into a neg instruction. - value = T(-std::numeric_limits::max() - T(i - std::numeric_limits::max())); + // this is always optimized into a neg instruction (note: T is an integer type) + value = T(-std::numeric_limits::max() - T(i - uint64_t(std::numeric_limits::max()))); #ifdef FASTFLOAT_VISUAL_STUDIO #pragma warning(pop) #endif