return MPI_ERR_TYPE;
if(comm==MPI_COMM_NULL)
return MPI_ERR_COMM;
- return type->pack(inbuf, incount, outbuf,outcount,position, comm);
+ return type->pack(inbuf == MPI_BOTTOM ? nullptr : inbuf, incount, outbuf, outcount, position, comm);
}
int PMPI_Pack_size(int incount, MPI_Datatype datatype, MPI_Comm comm, int* size) {
int Datatype::pack(void* inbuf, int incount, void* outbuf, int outcount, int* position,MPI_Comm comm){
if (outcount - *position < incount*static_cast<int>(size_))
return MPI_ERR_BUFFER;
- Datatype::copy(inbuf == MPI_BOTTOM ? nullptr : inbuf, incount, this, static_cast<char*>(outbuf) + *position, outcount,
- MPI_CHAR);
+ Datatype::copy(inbuf, incount, this, static_cast<char*>(outbuf) + *position, outcount, MPI_CHAR);
*position += incount * size_;
return MPI_SUCCESS;
}