Smarter computation of the required space for the struct.
This commit was SVN r1090.
Этот коммит содержится в:
родитель
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
|
||||
* avoid increasing the size of the desc array often.
|
||||
*/
|
||||
for( disp = 0, i = 0; i < count; i++ ) {
|
||||
disp += pTypes[i]->desc.used;
|
||||
if( pBlockLength[i] != 1 ) disp += 2;
|
||||
for( lastType = pTypes[0], lastBlock = 0, disp = 0, i = 0; i < count; i++ ) {
|
||||
if( lastType == pTypes[i] ) {
|
||||
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];
|
||||
lastBlock = pBlockLength[0];
|
||||
lastExtent = lastType->ub - lastType->lb;
|
||||
|
Загрузка…
x
Ссылка в новой задаче
Block a user