mirror of
https://github.com/YosysHQ/abc.git
synced 2026-09-07 03:05:36 +02:00
Changes and improvements to different packages.
This commit is contained in:
+15
-4
@@ -1715,16 +1715,27 @@ static inline void Vec_IntSelectSort( int * pArray, int nSize )
|
||||
***********************************************************************/
|
||||
static inline void Vec_IntSelectSortCost( int * pArray, int nSize, Vec_Int_t * vCosts )
|
||||
{
|
||||
int temp, i, j, best_i;
|
||||
int i, j, best_i;
|
||||
for ( i = 0; i < nSize-1; i++ )
|
||||
{
|
||||
best_i = i;
|
||||
for ( j = i+1; j < nSize; j++ )
|
||||
if ( Vec_IntEntry(vCosts, pArray[j]) < Vec_IntEntry(vCosts, pArray[best_i]) )
|
||||
best_i = j;
|
||||
temp = pArray[i];
|
||||
pArray[i] = pArray[best_i];
|
||||
pArray[best_i] = temp;
|
||||
ABC_SWAP( int, pArray[i], pArray[best_i] );
|
||||
}
|
||||
}
|
||||
static inline void Vec_IntSelectSortCost2( int * pArray, int nSize, int * pCosts )
|
||||
{
|
||||
int i, j, best_i;
|
||||
for ( i = 0; i < nSize-1; i++ )
|
||||
{
|
||||
best_i = i;
|
||||
for ( j = i+1; j < nSize; j++ )
|
||||
if ( pCosts[j] < pCosts[best_i] )
|
||||
best_i = j;
|
||||
ABC_SWAP( int, pArray[i], pArray[best_i] );
|
||||
ABC_SWAP( int, pCosts[i], pCosts[best_i] );
|
||||
}
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user