Skip to content
Snippets Groups Projects

L1 [bugfix]: reimplemented serialization of SIMD vectors

Merged Sergei Zharko requested to merge s.zharko/cbmroot:L1Algo-dev12 into master
1 file
+ 20
3
Compare changes
  • Side-by-side
  • Inline
@@ -11,20 +11,37 @@
#define L1SimdSerializer_h 1
#include <boost/serialization/access.hpp>
#include <boost/serialization/split_free.hpp>
#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 serialization
{
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) {
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 boost
Loading