1
0
mirror of https://github.com/nlohmann/json.git synced 2025-07-29 23:01:16 +03:00

Merge pull request #2116 from nlohmann/issue2113

Fix warnings from Clang 10 and GCC 9
This commit is contained in:
Niels Lohmann
2020-05-17 12:19:06 +02:00
committed by GitHub
8 changed files with 47 additions and 20 deletions

View File

@ -5612,7 +5612,7 @@ namespace detail
@note from https://stackoverflow.com/a/1001328/266378
*/
static bool little_endianess(int num = 1) noexcept
static inline bool little_endianess(int num = 1) noexcept
{
return *reinterpret_cast<char*>(&num) == 1;
}
@ -12205,9 +12205,9 @@ class binary_writer
}
else
{
if (j.m_value.number_float >= std::numeric_limits<float>::lowest() and
j.m_value.number_float <= std::numeric_limits<float>::max() and
static_cast<double>(static_cast<float>(j.m_value.number_float)) == j.m_value.number_float)
if (static_cast<double>(j.m_value.number_float) >= static_cast<double>(std::numeric_limits<float>::lowest()) and
static_cast<double>(j.m_value.number_float) <= static_cast<double>(std::numeric_limits<float>::max()) and
static_cast<double>(static_cast<float>(j.m_value.number_float)) == static_cast<double>(j.m_value.number_float))
{
oa->write_character(get_cbor_float_prefix(static_cast<float>(j.m_value.number_float)));
write_number(static_cast<float>(j.m_value.number_float));