Fix compat with max() macro

This commit is contained in:
Kai Pastor 2026-07-21 11:26:09 +02:00
parent f6df0f2917
commit ec239e0e04

View File

@ -804,7 +804,7 @@ parse_int_string(UC const *p, UC const *pend, T &value,
// check other types overflow
if (!std::is_same<T, uint64_t>::value) {
if (i > uint64_t(std::numeric_limits<T>::max()) + uint64_t(negative)) {
if (i > uint64_t((std::numeric_limits<T>::max)()) + uint64_t(negative)) {
answer.ec = std::errc::result_out_of_range;
return answer;
}
@ -821,8 +821,8 @@ parse_int_string(UC const *p, UC const *pend, T &value,
// - reinterpret_casting (~i + 1) would work, but it is not constexpr
// this is always optimized into a neg instruction (note: T is an integer
// type)
value = T(-std::numeric_limits<T>::max() -
T(i - uint64_t(std::numeric_limits<T>::max())));
value = T(-(std::numeric_limits<T>::max)() -
T(i - uint64_t((std::numeric_limits<T>::max)())));
#ifdef FASTFLOAT_VISUAL_STUDIO
#pragma warning(pop)
#endif