Skip to content
Snippets Groups Projects
Commit 3f37ad42 authored by Sergei Zharko's avatar Sergei Zharko
Browse files

L1 [bugfix]: reimplemented serialization of SIMD vectors

parent 470b757f
No related branches found
No related tags found
1 merge request!941L1 [bugfix]: reimplemented serialization of SIMD vectors
Pipeline #18805 passed
...@@ -11,20 +11,37 @@ ...@@ -11,20 +11,37 @@
#define L1SimdSerializer_h 1 #define L1SimdSerializer_h 1
#include <boost/serialization/access.hpp> #include <boost/serialization/access.hpp>
#include <boost/serialization/split_free.hpp>
#include "vectors/L1vec.h" #include "vectors/L1vec.h"
/// This header defines functionality for saving and loading SIMDized vectors. At the moment, only the first element of
/// the vector can be saved, and the loaded vector will be horizontally equal.
///
namespace boost namespace boost
{ {
namespace serialization namespace serialization
{ {
template<class Archive> template<class Archive>
void serialize(Archive& ar, fvec& vect, const unsigned int) void save(Archive& ar, const fvec& vect, unsigned int)
{
ar << vect[0];
}
template<class Archive>
void load(Archive& ar, fvec& vect, unsigned int)
{ {
fscal buffer;
ar >> buffer;
for (size_t i = 0; i < fvec::size(); ++i) { for (size_t i = 0; i < fvec::size(); ++i) {
ar&(reinterpret_cast<fscal*>(&vect))[i]; vect[i] = buffer;
} }
} }
template<class Archive>
void serialize(Archive& ar, fvec& vect, const unsigned int version)
{
split_free(ar, vect, version);
}
} // namespace serialization } // namespace serialization
} // namespace boost } // namespace boost
......
0% Loading or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment