update nlohmann::json to 3.10.4

This commit is contained in:
2021-12-11 23:32:21 +01:00
parent 4a1dde26ce
commit 42ff7c8099
39 changed files with 5323 additions and 2710 deletions

View File

@ -200,7 +200,7 @@ boundaries compute_boundaries(FloatType value)
using bits_type = typename std::conditional<kPrecision == 24, std::uint32_t, std::uint64_t >::type;
const std::uint64_t bits = reinterpret_bits<bits_type>(value);
const auto bits = static_cast<std::uint64_t>(reinterpret_bits<bits_type>(value));
const std::uint64_t E = bits >> (kPrecision - 1);
const std::uint64_t F = bits & (kHiddenBit - 1);
@ -490,51 +490,49 @@ inline int find_largest_pow10(const std::uint32_t n, std::uint32_t& pow10)
return 10;
}
// LCOV_EXCL_STOP
else if (n >= 100000000)
if (n >= 100000000)
{
pow10 = 100000000;
return 9;
}
else if (n >= 10000000)
if (n >= 10000000)
{
pow10 = 10000000;
return 8;
}
else if (n >= 1000000)
if (n >= 1000000)
{
pow10 = 1000000;
return 7;
}
else if (n >= 100000)
if (n >= 100000)
{
pow10 = 100000;
return 6;
}
else if (n >= 10000)
if (n >= 10000)
{
pow10 = 10000;
return 5;
}
else if (n >= 1000)
if (n >= 1000)
{
pow10 = 1000;
return 4;
}
else if (n >= 100)
if (n >= 100)
{
pow10 = 100;
return 3;
}
else if (n >= 10)
if (n >= 10)
{
pow10 = 10;
return 2;
}
else
{
pow10 = 1;
return 1;
}
pow10 = 1;
return 1;
}
inline void grisu2_round(char* buf, int len, std::uint64_t dist, std::uint64_t delta,
@ -620,7 +618,7 @@ inline void grisu2_digit_gen(char* buffer, int& length, int& decimal_exponent,
JSON_ASSERT(p1 > 0);
std::uint32_t pow10;
std::uint32_t pow10{};
const int k = find_largest_pow10(p1, pow10);
// 10^(k-1) <= p1 < 10^k, pow10 = 10^(k-1)
@ -1068,6 +1066,10 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '-';
}
#ifdef __GNUC__
#pragma GCC diagnostic push
#pragma GCC diagnostic ignored "-Wfloat-equal"
#endif
if (value == 0) // +-0
{
*first++ = '0';
@ -1076,6 +1078,9 @@ char* to_chars(char* first, const char* last, FloatType value)
*first++ = '0';
return first;
}
#ifdef __GNUC__
#pragma GCC diagnostic pop
#endif
JSON_ASSERT(last - first >= std::numeric_limits<FloatType>::max_digits10);