diff options
author | Alan Mishchenko <alanmi@berkeley.edu> | 2014-06-19 11:26:06 -0700 |
---|---|---|
committer | Alan Mishchenko <alanmi@berkeley.edu> | 2014-06-19 11:26:06 -0700 |
commit | 0c6f196e2aed5138e2b5887a88fc92ad5a545118 (patch) | |
tree | e597e083ac6ed9b010f5229d024e1bc23578e996 /src/misc/vec/vecPtr.h | |
parent | 9842a666e6c1d2546c940c48bbd6602a448bc01b (diff) | |
download | abc-0c6f196e2aed5138e2b5887a88fc92ad5a545118.tar.gz abc-0c6f196e2aed5138e2b5887a88fc92ad5a545118.tar.bz2 abc-0c6f196e2aed5138e2b5887a88fc92ad5a545118.zip |
Experiments with MUX profiling.
Diffstat (limited to 'src/misc/vec/vecPtr.h')
-rw-r--r-- | src/misc/vec/vecPtr.h | 25 |
1 files changed, 25 insertions, 0 deletions
diff --git a/src/misc/vec/vecPtr.h b/src/misc/vec/vecPtr.h index d0204ebb..a666f45f 100644 --- a/src/misc/vec/vecPtr.h +++ b/src/misc/vec/vecPtr.h @@ -883,6 +883,31 @@ static void Vec_PtrUniqify( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)() ) p->pArray[k++] = p->pArray[i]; p->nSize = k; } +static void Vec_PtrUniqify2( Vec_Ptr_t * p, int (*Vec_PtrSortCompare)(), void (*Vec_PtrObjFree)(), Vec_Int_t * vCounts ) +{ + int i, k; + if ( vCounts ) + Vec_IntFill( vCounts, 1, 1 ); + if ( p->nSize < 2 ) + return; + Vec_PtrSort( p, Vec_PtrSortCompare ); + for ( i = k = 1; i < p->nSize; i++ ) + if ( Vec_PtrSortCompare(p->pArray+i, p->pArray+k-1) != 0 ) + { + p->pArray[k++] = p->pArray[i]; + if ( vCounts ) + Vec_IntPush( vCounts, 1 ); + } + else + { + if ( Vec_PtrObjFree ) + Vec_PtrObjFree( p->pArray[i] ); + if ( vCounts ) + Vec_IntAddToEntry( vCounts, Vec_IntSize(vCounts)-1, 1 ); + } + p->nSize = k; + assert( vCounts == NULL || Vec_IntSize(vCounts) == Vec_PtrSize(p) ); +} |