Ticket #9208: boostMPIpatch.diff
File boostMPIpatch.diff, 1.9 KB (added by , 9 years ago) |
---|
-
detail/packed_oprimitive.hpp
20 20 #include <boost/assert.hpp> 21 21 #include <vector> 22 22 #include <boost/mpi/allocator.hpp> 23 //#include <boost/numeric/conversion/cast.hpp> // provides boost::numeric_cast 23 24 24 25 namespace boost { namespace mpi { 25 26 … … 81 82 { 82 83 unsigned int l = static_cast<unsigned int>(s.size()); 83 84 save(l); 84 if (l) 85 save_impl(s.data(),get_mpi_datatype(CharType()),s.size()); 85 save_impl(s.data(),get_mpi_datatype(CharType()),s.size()); 86 86 } 87 87 88 void save( const boost::archive::version_type& v ) 89 { 90 unsigned position = buffer_.size(); 91 buffer_.resize( position+1 ); 92 // Require conversion to a 1-byte int 93 // uint8_t compactV = boost::numeric_cast<uint8_t>( v ); // type safe 94 uint8_t compactV = v; // not really safe! 95 buffer_[ position ] = compactV; 96 } 97 88 98 private: 89 99 90 100 void save_impl(void const * p, MPI_Datatype t, int l) -
detail/packed_iprimitive.hpp
94 94 load(l); 95 95 s.resize(l); 96 96 // note breaking a rule here - could be a problem on some platform 97 if (l) 98 load_impl(const_cast<CharType *>(s.data()), 99 get_mpi_datatype(CharType()),l); 97 load_impl(const_cast<CharType *>(s.data()),get_mpi_datatype(CharType()),l); 100 98 } 101 99 100 void load( boost::archive::version_type& v ) 101 { 102 v = static_cast<boost::archive::version_type>( buffer_[ position ] ); 103 ++position; 104 } 105 102 106 private: 103 107 104 108 void load_impl(void * p, MPI_Datatype t, int l)