Do proper endian conversions
This fixes all testsuite failures on big endian hosts.
This commit is contained in:
parent
e326df211b
commit
bb22b1003f
4 changed files with 6 additions and 7 deletions
|
@ -599,9 +599,8 @@ struct pod_serializer
|
|||
static void to_json(BasicJsonType& j, const T& t) noexcept
|
||||
{
|
||||
auto bytes = static_cast< const unsigned char*>(static_cast<const void*>(&t));
|
||||
std::uint64_t value = bytes[0];
|
||||
for (auto i = 1; i < 8; ++i)
|
||||
value |= std::uint64_t{bytes[i]} << 8 * i;
|
||||
std::uint64_t value;
|
||||
std::memcpy(&value, bytes, sizeof(value));
|
||||
nlohmann::to_json(j, value);
|
||||
}
|
||||
};
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue