mirror of
https://github.com/nlohmann/json.git
synced 2025-07-24 02:21:01 +03:00
Merge pull request #1489 from andreas-schwab/develop
Do proper endian conversions
This commit is contained in:
@ -8334,7 +8334,7 @@ class binary_reader
|
||||
}
|
||||
|
||||
// reverse byte order prior to conversion if necessary
|
||||
if (is_little_endian && !InputIsLittleEndian)
|
||||
if (is_little_endian != InputIsLittleEndian)
|
||||
{
|
||||
vec[sizeof(NumberType) - i - 1] = static_cast<uint8_t>(current);
|
||||
}
|
||||
@ -9747,7 +9747,7 @@ class binary_writer
|
||||
std::memcpy(vec.data(), &n, sizeof(NumberType));
|
||||
|
||||
// step 2: write array to output (with possible reordering)
|
||||
if (is_little_endian and not OutputIsLittleEndian)
|
||||
if (is_little_endian != OutputIsLittleEndian)
|
||||
{
|
||||
// reverse byte order prior to conversion if necessary
|
||||
std::reverse(vec.begin(), vec.end());
|
||||
|
Reference in New Issue
Block a user