From 382a0209f706494309cd0a565ef7d358ddf492f2 Mon Sep 17 00:00:00 2001 From: George Bosilca Date: Wed, 21 Jun 2006 14:05:09 +0000 Subject: [PATCH] Correctly play with the flags. Ported from the 1.1 branch. This commit was SVN r10449. --- ompi/datatype/convertor.c | 16 ++++++++-------- ompi/datatype/convertor.h | 10 +++++----- ompi/datatype/datatype.h | 8 ++++---- 3 files changed, 17 insertions(+), 17 deletions(-) diff --git a/ompi/datatype/convertor.c b/ompi/datatype/convertor.c index 94fb897df2..24d4a8ca9e 100644 --- a/ompi/datatype/convertor.c +++ b/ompi/datatype/convertor.c @@ -180,8 +180,8 @@ int32_t ompi_convertor_pack( ompi_convertor_t* pConv, { OMPI_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); - if( ((pConv->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC) && - !(pConv->flags & CONVERTOR_WITH_CHECKSUM) ) { + if( !(pConv->flags & CONVERTOR_WITH_CHECKSUM) && + (pConv->flags & DT_FLAG_NO_GAPS) ) { /* We are doing conversion on a predefined contiguous datatype. The * convertor contain minimal informations, we only use the bConverted * to manage the conversion. @@ -226,9 +226,9 @@ inline int32_t ompi_convertor_unpack( ompi_convertor_t* pConv, { OMPI_CONVERTOR_SET_STATUS_BEFORE_PACK_UNPACK( pConv, iov, out_size, max_data ); - if( ((pConv->flags & (DT_FLAG_BASIC | CONVERTOR_HOMOGENEOUS)) == - (DT_FLAG_BASIC | CONVERTOR_HOMOGENEOUS)) && - !(pConv->flags & CONVERTOR_WITH_CHECKSUM) ) { + if( !(pConv->flags & CONVERTOR_WITH_CHECKSUM) && + ((pConv->flags & (CONVERTOR_HOMOGENEOUS | DT_FLAG_NO_GAPS)) == + (CONVERTOR_HOMOGENEOUS | DT_FLAG_NO_GAPS)) ) { /* We are doing conversion on a contiguous datatype on a homogeneous * environment. The convertor contain minimal informations, we only * use the bConverted to manage the conversion. @@ -426,10 +426,10 @@ int32_t ompi_convertor_set_position_nocheck( ompi_convertor_t* convertor, assert( NULL != convertor->use_desc->desc ); \ /* For predefined datatypes (contiguous) do nothing more */ \ /* if checksum is enabled the always continue */ \ - if( ((convertor->flags & DT_FLAG_BASIC) == DT_FLAG_BASIC) && \ - !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && \ + if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && \ + (convertor->flags & DT_FLAG_NO_GAPS) && \ ((convertor->flags & CONVERTOR_SEND) || \ - (convertor->flags & CONVERTOR_HOMOGENEOUS) ) ) { \ + (convertor->flags & CONVERTOR_HOMOGENEOUS)) ) { \ convertor->bConverted = 0; \ return OMPI_SUCCESS; \ } \ diff --git a/ompi/datatype/convertor.h b/ompi/datatype/convertor.h index 8d27d93860..114c9c39d1 100644 --- a/ompi/datatype/convertor.h +++ b/ompi/datatype/convertor.h @@ -265,14 +265,14 @@ ompi_convertor_set_position( ompi_convertor_t* convertor, /* Remove the completed flag if it's already set */ convertor->flags &= ~CONVERTOR_COMPLETED; - if( (convertor->flags & (DT_FLAG_PREDEFINED | CONVERTOR_HOMOGENEOUS)) == - (DT_FLAG_PREDEFINED | CONVERTOR_HOMOGENEOUS) && - !(convertor->flags & CONVERTOR_WITH_CHECKSUM) ) { - /* basic predefined datatype (contiguous) */ + if( !(convertor->flags & CONVERTOR_WITH_CHECKSUM) && + (convertor->flags & DT_FLAG_NO_GAPS) && + ((convertor->flags & CONVERTOR_SEND) || + (convertor->flags & CONVERTOR_HOMOGENEOUS)) ) { + /* Contiguous and no checkpoint and no homogeneous unpack */ convertor->bConverted = *position; return OMPI_SUCCESS; } - return ompi_convertor_set_position_nocheck( convertor, position ); } diff --git a/ompi/datatype/datatype.h b/ompi/datatype/datatype.h index 761654e314..1b663a548e 100644 --- a/ompi/datatype/datatype.h +++ b/ompi/datatype/datatype.h @@ -190,10 +190,10 @@ static inline int32_t ompi_ddt_get_size( const ompi_datatype_t* pData, unsigned */ static inline int32_t ompi_ddt_is_contiguous_memory_layout( const ompi_datatype_t* datatype, int32_t count ) { - if( !(datatype->flags & DT_FLAG_CONTIGUOUS) ) return 0; - if( count == 1 ) return 1; /* only one data ignore the gaps around */ - if( (long)datatype->size != (datatype->ub - datatype->lb) ) return 0; - return 1; + if( !(datatype->flags & DT_FLAG_CONTIGUOUS) ) return 0; + if( (count == 1) || (datatype->flags & DT_FLAG_NO_GAPS) ) return 1; + assert( (long)datatype->size != (datatype->ub - datatype->lb) ); + return 0; } OMPI_DECLSPEC int32_t ompi_ddt_get_element_count( const ompi_datatype_t* pData, int32_t iSize );