BinaryArchive platform compatibility

This commit is contained in:
Matthias Hochsteger 2023-08-23 15:15:59 +02:00
parent aeadc7f79a
commit 22b45dde67

View File

@ -864,7 +864,15 @@ namespace ngcore
Archive & Do (int * i, size_t n) override Archive & Do (int * i, size_t n) override
{ stream->read(reinterpret_cast<char*>(i), n*sizeof(int)); return *this; } // NOLINT { stream->read(reinterpret_cast<char*>(i), n*sizeof(int)); return *this; } // NOLINT
Archive & Do (size_t * i, size_t n) override Archive & Do (size_t * i, size_t n) override
{ stream->read(reinterpret_cast<char*>(i), n*sizeof(size_t)); return *this; } // NOLINT {
// for platform independence
if constexpr (sizeof(long) == 8)
stream->read(reinterpret_cast<char*>(i), n*sizeof(size_t)); // NOLINT
else
for(size_t j = 0; j < n; j++)
(*this) & i[j];
return *this;
}
private: private:
template<typename T> template<typename T>