compatibility fix

This commit is contained in:
Daniel Lemire 2025-09-18 07:44:05 -06:00
parent e5612e9f72
commit 48fc5404d4

View File

@ -1132,13 +1132,10 @@ template <typename T> constexpr uint64_t int_luts<T>::min_safe_u64[];
template <typename UC>
fastfloat_really_inline constexpr uint8_t ch_to_digit(UC c) {
// wchar_t and char can be signed, so we need to be careful.
using UnsignedUC = typename std::make_unsigned<UC>::type;
auto uc = static_cast<UnsignedUC>(c);
// For types larger than one byte, we need to force an index with sentinel
// value (using index zero because that is easiest) if any byte other than
// the low byte is non-zero.
auto mask = static_cast<UnsignedUC>(-((uc & ~0xFFull) == 0));
return int_luts<>::chdigit[static_cast<unsigned char>(uc & mask)];
return int_luts<>::chdigit[static_cast<unsigned char>(static_cast<UnsignedUC>(c)
& static_cast<UnsignedUC>(-((static_cast<UnsignedUC>(c) & ~0xFFull) == 0)))];
}
fastfloat_really_inline constexpr size_t max_digits_u64(int base) {