mirror of
https://github.com/fastfloat/fast_float.git
synced 2025-12-06 08:46:49 +08:00
compatibility fix
This commit is contained in:
parent
e5612e9f72
commit
48fc5404d4
@ -1132,13 +1132,10 @@ template <typename T> constexpr uint64_t int_luts<T>::min_safe_u64[];
|
|||||||
|
|
||||||
template <typename UC>
|
template <typename UC>
|
||||||
fastfloat_really_inline constexpr uint8_t ch_to_digit(UC c) {
|
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;
|
using UnsignedUC = typename std::make_unsigned<UC>::type;
|
||||||
auto uc = static_cast<UnsignedUC>(c);
|
return int_luts<>::chdigit[static_cast<unsigned char>(static_cast<UnsignedUC>(c)
|
||||||
// For types larger than one byte, we need to force an index with sentinel
|
& static_cast<UnsignedUC>(-((static_cast<UnsignedUC>(c) & ~0xFFull) == 0)))];
|
||||||
// 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)];
|
|
||||||
}
|
}
|
||||||
|
|
||||||
fastfloat_really_inline constexpr size_t max_digits_u64(int base) {
|
fastfloat_really_inline constexpr size_t max_digits_u64(int base) {
|
||||||
|
|||||||
Loading…
x
Reference in New Issue
Block a user