1
1

Remove useless fields on the convertor struct.

All initializations should be done ONCE (and only once).
Remove some double checks.

This commit was SVN r5148.
Этот коммит содержится в:
George Bosilca 2005-04-03 02:15:36 +00:00
родитель 1700c1e114
Коммит 7907ac3de1
5 изменённых файлов: 7 добавлений и 20 удалений

Просмотреть файл

@ -208,20 +208,19 @@ typedef struct __dt_stack {
struct ompi_convertor_t {
ompi_object_t super; /**< basic superclass */
dt_desc_t* pDesc; /**< the datatype description associated with the convertor */
uint32_t remoteArch; /**< the remote architecture */
uint32_t converted; /**< the number of already converted elements */
uint32_t bConverted; /**< the size of already converted elements in bytes */
uint32_t flags; /**< the properties of this convertor */
dt_desc_t* pDesc; /**< the datatype description associated with the convertor */
uint32_t count; /**< the total number of full datatype elements */
dt_stack_t* pStack; /**< the local stack for the actual conversion */
uint32_t stack_pos; /**< the actual position on the stack */
uint32_t stack_size; /**< size of the allocated stack */
char* pBaseBuf; /**< initial buffer as supplied by the user */
uint32_t available_space; /**< total available space */
dt_stack_t* pStack; /**< the local stack for the actual conversion */
uint32_t stack_size; /**< size of the allocated stack */
convertor_advance_fct_t fAdvance; /**< pointer to the pack/unpack functions */
memalloc_fct_t memAlloc_fn; /**< pointer to the memory allocation function */
conversion_fct_t* pFunctions; /**< the convertor functions pointer */
/* All others fields get modified for every call to pack/unpack functions */
uint32_t stack_pos; /**< the actual position on the stack */
uint32_t bConverted; /**< the size of already converted elements in bytes */
dt_stack_t static_stack[DT_STATIC_STACK_SIZE]; /**< local stack to be used for contiguous data */
};
OBJ_CLASS_DECLARATION( ompi_convertor_t );
@ -309,7 +308,6 @@ static inline int ompi_convertor_copy( const ompi_convertor_t* pSrcConv, ompi_co
pDestConv->pStack = pDestConv->static_stack;
pDestConv->stack_size = DT_STATIC_STACK_SIZE;
pDestConv->stack_pos = 0;
pDestConv->available_space = 0;
pDestConv->pFunctions = pSrcConv->pFunctions;
return OMPI_SUCCESS;

Просмотреть файл

@ -368,9 +368,7 @@ int ompi_convertor_create_stack_at_begining( ompi_convertor_t* pConvertor, const
} else {
ompi_output( 0, "Here we should have a data in the datatype description\n" );
}
/* And set the correct status */
pConvertor->converted = 0;
pConvertor->bConverted = 0;
pConvertor->bConverted = 0;
return OMPI_SUCCESS;
}
@ -396,10 +394,7 @@ convertor_init_generic( ompi_convertor_t* pConv, const dt_desc_t* datatype, int
}
pConv->pBaseBuf = (void*)pUserBuf;
pConv->available_space = count * (datatype->ub - datatype->lb);
pConv->count = count;
pConv->converted = 0;
pConv->bConverted = 0;
}
#if defined(c_plusplus) || defined(__cplusplus)

Просмотреть файл

@ -127,7 +127,6 @@ int ompi_convertor_pack_general( ompi_convertor_t* pConvertor,
printf( "pack there is still room in the input buffer %d bytes\n", iCount );
goto complete_loop;
}
pConvertor->converted += rc; /* number of elementd converted so far */
pos_desc++; /* advance to the next data */
count_desc = pElem[pos_desc].count;
disp_desc = pElem[pos_desc].disp;

Просмотреть файл

@ -138,7 +138,6 @@ static int ompi_convertor_unpack_general( ompi_convertor_t* pConvertor,
printf( "unpack there is still room in the input buffer %d bytes\n", iCount );
goto save_and_return;
}
pConvertor->converted += rc; /* number of elements converted so far */
pos_desc++; /* advance to the next data */
count_desc = pElems[pos_desc].count;
disp_desc = pElems[pos_desc].disp;

Просмотреть файл

@ -82,10 +82,6 @@ int ompi_convertor_create_stack_with_pos_general( ompi_convertor_t* pConvertor,
pStack->count = pConvertor->count;
pStack->index = -1;
if( pConvertor->flags & CONVERTOR_HOMOGENEOUS ) {
if( pData->opt_desc.desc != NULL ) {
pElems = pData->opt_desc.desc;
pStack->end_loop = pData->opt_desc.used;
}
loop_length = GET_FIRST_NON_LOOP( pElems );
pStack->disp = pElems[loop_length].disp;