diff --git a/src/Compression/CompressionCodecT64.cpp b/src/Compression/CompressionCodecT64.cpp index 9ed37c2d676..887c8b9e9d2 100644 --- a/src/Compression/CompressionCodecT64.cpp +++ b/src/Compression/CompressionCodecT64.cpp @@ -307,7 +307,19 @@ void reverseTransposeBytes(const UInt64 * matrix, UInt32 col, T & value) template void load(const char * src, T * buf, UInt32 tail = 64) { - memcpy(buf, src, tail * sizeof(T)); + if constexpr (std::endian::native == std::endian::little) + { + memcpy(buf, src, tail * sizeof(T)); + } + else + { + /// Since the algorithm uses little-endian integers, data is loaded + /// as little-endian types on big-endian machine(s390x, etc.) + for (UInt32 i = 0; i < tail; i++) + { + buf[i] = unalignedLoadLE(src + i * sizeof(T)); + } + } } template