diff --git a/include/nlohmann/detail/output/binary_writer.hpp b/include/nlohmann/detail/output/binary_writer.hpp index 146f71db5..0659dd013 100644 --- a/include/nlohmann/detail/output/binary_writer.hpp +++ b/include/nlohmann/detail/output/binary_writer.hpp @@ -1617,7 +1617,7 @@ class binary_writer std::memcpy(vec.data(), &n, sizeof(NumberType)); // step 2: write array to output (with possible reordering) - if (is_little_endian != (OutputIsLittleEndian || use_bjdata)) + if (is_little_endian != (use_bjdata || OutputIsLittleEndian)) { // reverse byte order prior to conversion if necessary std::reverse(vec.begin(), vec.end()); diff --git a/single_include/nlohmann/json.hpp b/single_include/nlohmann/json.hpp index 0b30ab140..a5bcf37e6 100644 --- a/single_include/nlohmann/json.hpp +++ b/single_include/nlohmann/json.hpp @@ -15441,7 +15441,7 @@ class binary_writer std::memcpy(vec.data(), &n, sizeof(NumberType)); // step 2: write array to output (with possible reordering) - if (is_little_endian != (OutputIsLittleEndian || use_bjdata)) + if (is_little_endian != (use_bjdata || OutputIsLittleEndian)) { // reverse byte order prior to conversion if necessary std::reverse(vec.begin(), vec.end());