legacy_sources/v1/libparallel.c
/*----------------------------------------------------------*/
/* Allocate a dependency matrix linking both types			*/
/*----------------------------------------------------------*/
Allocate a dependency matrix linking both types
Allocate a dependency matrix linking both types
int BeginDependency(int TypIdx1, int TypIdx2)
{
	int i, res;
	TypSct *typ1 = &par->TypTab[ TypIdx1 ], *typ2 = &par->TypTab[ TypIdx2 ];
	if( (TypIdx1 < 1) || (TypIdx1 > MaxTyp) || (TypIdx2 < 1) || (TypIdx2 > MaxTyp) || (typ1 == typ2) \
	|| !typ1->NmbLin || !typ2->NmbLin)
	{
		return(0);
	}
	par->CurTyp = typ1;
	typ1->NmbDep = typ2->NmbLin / (DepSiz * 32);
	if(res = typ2->NmbLin - typ1->NmbDep * DepSiz * 32)
		typ1->NmbDep++;
	if(!(typ1->DepTab = calloc(typ1->NmbWrk * typ1->NmbDep , sizeof(int))))
		return(0);
	for(i=0;i<typ1->NmbWrk;i++)
	{
		typ1->WrkTab[i].NmbBit = 0;
		typ1->WrkTab[i].dep = &typ1->DepTab[ i * typ1->NmbDep ];
	}
	return(1);
}
int BeginDependency ( int TypIdx1 , int TypIdx2 ) { int i , res ; TypSct * typ1 = & par -> TypTab [ TypIdx1 ] , * typ2 = & par -> TypTab [ TypIdx2 ] ; if ( ( TypIdx1 < 1 ) || ( TypIdx1 > MaxTyp ) || ( TypIdx2 < 1 ) || ( TypIdx2 > MaxTyp ) || ( typ1 == typ2 ) || ! typ1 -> NmbLin || ! typ2 -> NmbLin ) { return ( 0 ) ; } par -> CurTyp = typ1 ; typ1 -> NmbDep = typ2 -> NmbLin / ( DepSiz * 32 ) ; if ( res = typ2 -> NmbLin - typ1 -> NmbDep * DepSiz * 32 ) typ1 -> NmbDep ++ ; if ( ! ( typ1 -> DepTab = calloc ( typ1 -> NmbWrk * typ1 -> NmbDep , sizeof ( int ) ) ) ) return ( 0 ) ; for ( i = 0 ; i < typ1 -> NmbWrk ; i ++ ) { typ1 -> WrkTab [ i ] . NmbBit = 0 ; typ1 -> WrkTab [ i ] . dep = & typ1 -> DepTab [ i * typ1 -> NmbDep ] ; } return ( 1 ) ; }
Allocate a dependency matrix linking both types
Allocate a dependency matrix linking both types
/* Check bounds */ /* Allocate a global dependency table */ /* Then spread sub-tables among WP */