From 1ba16ff782064619d40cba68dd24cbe291aaf538 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sun, 27 Sep 2015 19:16:08 -0700 Subject: Experiments with LUT structure mapping. --- src/misc/vec/vecInt.h | 40 ++++++++++++++++++++++++++++++++++++++++ 1 file changed, 40 insertions(+) (limited to 'src/misc') 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************************************************************* -- cgit v1.2.3