1
1

Smarter computation of the required space for the struct.

This commit was SVN r1090.
Этот коммит содержится в:
George Bosilca 2004-04-27 18:06:07 +00:00
родитель 1fb66840e1
Коммит 434ebd2dfc

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

@ -12,10 +12,19 @@ int lam_ddt_create_struct( int count, int* pBlockLength, long* pDisp,
/* if we compute the total number of elements before we can /* if we compute the total number of elements before we can
* avoid increasing the size of the desc array often. * avoid increasing the size of the desc array often.
*/ */
for( disp = 0, i = 0; i < count; i++ ) { for( lastType = pTypes[0], lastBlock = 0, disp = 0, i = 0; i < count; i++ ) {
disp += pTypes[i]->desc.used; if( lastType == pTypes[i] ) {
if( pBlockLength[i] != 1 ) disp += 2; lastBlock += pBlockLength[i];
} else {
disp += lastType->desc.used;
if( lastBlock != 1 ) disp += 2;
lastType = pTypes[i];
lastBlock = pBlockLength[i];
} }
}
disp += lastType->desc.used;
if( lastBlock != 1 ) disp += 2;
lastType = pTypes[0]; lastType = pTypes[0];
lastBlock = pBlockLength[0]; lastBlock = pBlockLength[0];
lastExtent = lastType->ub - lastType->lb; lastExtent = lastType->ub - lastType->lb;