summaryrefslogtreecommitdiffstats
path: root/src/misc
diff options
context:
space:
mode:
Diffstat (limited to 'src/misc')
-rw-r--r--src/misc/util/utilNam.h3
-rw-r--r--src/misc/vec/vecInt.h19
2 files changed, 18 insertions, 4 deletions
diff --git a/src/misc/util/utilNam.h b/src/misc/util/utilNam.h
index be8067a9..9f3048f3 100644
--- a/src/misc/util/utilNam.h
+++ b/src/misc/util/utilNam.h
@@ -42,6 +42,9 @@ typedef struct Abc_Nam_t_ Abc_Nam_t;
/// MACRO DEFINITIONS ///
////////////////////////////////////////////////////////////////////////
+#define Abc_NamManForEachObj( p, pStr, i ) \
+ for ( i = 1; (i < Abc_NamObjNumMax(p)) && ((pStr) = Abc_NamStr(p, i)); i++ )
+
////////////////////////////////////////////////////////////////////////
/// FUNCTION DECLARATIONS ///
////////////////////////////////////////////////////////////////////////
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 535a15ef..6d015bcc 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -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] );
}
}