X-Git-Url: http://info.iut-bm.univ-fcomte.fr/pub/gitweb/simgrid.git/blobdiff_plain/fabf70a9d566725d01d925f83fae02ab82a95547..e44a0d71a8bacd7ab03e284fc32ad23731f5869c:/src/smpi/smpi_datatype_derived.cpp diff --git a/src/smpi/smpi_datatype_derived.cpp b/src/smpi/smpi_datatype_derived.cpp index cc008857ef..afc16cae5f 100644 --- a/src/smpi/smpi_datatype_derived.cpp +++ b/src/smpi/smpi_datatype_derived.cpp @@ -49,15 +49,14 @@ Type_Vector::~Type_Vector(){ void Type_Vector::serialize( void* noncontiguous_buf, void *contiguous_buf, int count){ - int i; char* contiguous_buf_char = static_cast(contiguous_buf); char* noncontiguous_buf_char = static_cast(noncontiguous_buf); - for (i = 0; i < block_count_ * count; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)) - memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size()); - else - old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char, block_length_); + for (int i = 0; i < block_count_ * count; i++) { + if (not(old_type_->flags() & DT_FLAG_DERIVED)) + memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size()); + else + old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char, block_length_); contiguous_buf_char += block_length_*old_type_->size(); if((i+1)%block_count_ ==0) @@ -69,12 +68,11 @@ void Type_Vector::serialize( void* noncontiguous_buf, void *contiguous_buf, void Type_Vector::unserialize( void* contiguous_buf, void *noncontiguous_buf, int count, MPI_Op op){ - int i; char* contiguous_buf_char = static_cast(contiguous_buf); char* noncontiguous_buf_char = static_cast(noncontiguous_buf); - for (i = 0; i < block_count_ * count; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)){ + for (int i = 0; i < block_count_ * count; i++) { + if (not(old_type_->flags() & DT_FLAG_DERIVED)) { if(op != MPI_OP_NULL) op->apply(contiguous_buf_char, noncontiguous_buf_char, &block_length_, old_type_); @@ -98,12 +96,11 @@ Type_Hvector::~Type_Hvector(){ void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, int count){ - int i; char* contiguous_buf_char = static_cast(contiguous_buf); char* noncontiguous_buf_char = static_cast(noncontiguous_buf); - for (i = 0; i < block_count_ * count; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)) + for (int i = 0; i < block_count_ * count; i++) { + if (not(old_type_->flags() & DT_FLAG_DERIVED)) memcpy(contiguous_buf_char, noncontiguous_buf_char, block_length_ * old_type_->size()); else old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_length_); @@ -119,12 +116,11 @@ void Type_Hvector::serialize( void* noncontiguous_buf, void *contiguous_buf, void Type_Hvector::unserialize( void* contiguous_buf, void *noncontiguous_buf, int count, MPI_Op op){ - int i; char* contiguous_buf_char = static_cast(contiguous_buf); char* noncontiguous_buf_char = static_cast(noncontiguous_buf); - for (i = 0; i < block_count_ * count; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)){ + for (int i = 0; i < block_count_ * count; i++) { + if (not(old_type_->flags() & DT_FLAG_DERIVED)) { if(op!=MPI_OP_NULL) op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_length_, old_type_); }else @@ -162,7 +158,7 @@ void Type_Indexed::serialize( void* noncontiguous_buf, void *contiguous_buf, char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+block_indices_[0] * old_type_->size(); for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)) + if (not(old_type_->flags() & DT_FLAG_DERIVED)) memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size()); else old_type_->serialize( noncontiguous_buf_char, contiguous_buf_char, block_lengths_[i]); @@ -186,7 +182,7 @@ void Type_Indexed::unserialize( void* contiguous_buf, void *noncontiguous_buf, static_cast(noncontiguous_buf)+block_indices_[0]*old_type_->get_extent(); for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)){ + if (not(old_type_->flags() & DT_FLAG_DERIVED)) { if(op!=MPI_OP_NULL) op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i], old_type_); @@ -230,7 +226,7 @@ void Type_Hindexed::serialize( void* noncontiguous_buf, void *contiguous_buf, char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+ block_indices_[0]; for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)) + if (not(old_type_->flags() & DT_FLAG_DERIVED)) memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_type_->size()); else old_type_->serialize(noncontiguous_buf_char, contiguous_buf_char,block_lengths_[i]); @@ -251,7 +247,7 @@ void Type_Hindexed::unserialize( void* contiguous_buf, void *noncontiguous_buf, char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+ block_indices_[0]; for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_type_->flags() & DT_FLAG_DERIVED)){ + if (not(old_type_->flags() & DT_FLAG_DERIVED)) { if(op!=MPI_OP_NULL) op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i], old_type_); @@ -298,7 +294,7 @@ void Type_Struct::serialize( void* noncontiguous_buf, void *contiguous_buf, char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+ block_indices_[0]; for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_types_[i]->flags() & DT_FLAG_DERIVED)) + if (not(old_types_[i]->flags() & DT_FLAG_DERIVED)) memcpy(contiguous_buf_char, noncontiguous_buf_char, block_lengths_[i] * old_types_[i]->size()); else old_types_[i]->serialize( noncontiguous_buf_char,contiguous_buf_char,block_lengths_[i]); @@ -320,7 +316,7 @@ void Type_Struct::unserialize( void* contiguous_buf, void *noncontiguous_buf, char* noncontiguous_buf_char = static_cast(noncontiguous_buf)+ block_indices_[0]; for (int j = 0; j < count; j++) { for (int i = 0; i < block_count_; i++) { - if (!(old_types_[i]->flags() & DT_FLAG_DERIVED)){ + if (not(old_types_[i]->flags() & DT_FLAG_DERIVED)) { if(op!=MPI_OP_NULL) op->apply( contiguous_buf_char, noncontiguous_buf_char, &block_lengths_[i], old_types_[i]); }else