summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-09-27 19:16:08 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-09-27 19:16:08 -0700
commit1ba16ff782064619d40cba68dd24cbe291aaf538 (patch)
tree448638b6847368373bb64c4faee2e4cafcaaff11 /src/misc/vec
parente3eea01dbb4c64d84b5ac46c92a9df55093cd7e0 (diff)
downloadabc-1ba16ff782064619d40cba68dd24cbe291aaf538.tar.gz
abc-1ba16ff782064619d40cba68dd24cbe291aaf538.tar.bz2
abc-1ba16ff782064619d40cba68dd24cbe291aaf538.zip
Experiments with LUT structure mapping.
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecInt.h40
1 files changed, 40 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index 8ef1c364..3d7c33fc 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -1843,6 +1843,20 @@ static inline void Vec_IntSelectSort( int * pArray, int nSize )
pArray[best_i] = temp;
}
}
+static inline void Vec_IntSelectSortReverse( int * pArray, int nSize )
+{
+ int temp, i, j, best_i;
+ for ( i = 0; i < nSize-1; i++ )
+ {
+ best_i = i;
+ for ( j = i+1; j < nSize; j++ )
+ if ( pArray[j] > pArray[best_i] )
+ best_i = j;
+ temp = pArray[i];
+ pArray[i] = pArray[best_i];
+ pArray[best_i] = temp;
+ }
+}
/**Function*************************************************************
@@ -1867,6 +1881,19 @@ static inline void Vec_IntSelectSortCost( int * pArray, int nSize, Vec_Int_t * v
ABC_SWAP( int, pArray[i], pArray[best_i] );
}
}
+static inline void Vec_IntSelectSortCostReverse( int * pArray, int nSize, Vec_Int_t * vCosts )
+{
+ 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;
+ ABC_SWAP( int, pArray[i], pArray[best_i] );
+ }
+}
+
static inline void Vec_IntSelectSortCost2( int * pArray, int nSize, int * pCosts )
{
int i, j, best_i;
@@ -1880,6 +1907,19 @@ static inline void Vec_IntSelectSortCost2( int * pArray, int nSize, int * pCosts
ABC_SWAP( int, pCosts[i], pCosts[best_i] );
}
}
+static inline void Vec_IntSelectSortCost2Reverse( 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] );
+ }
+}
/**Function*************************************************************