summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2014-03-22 16:24:44 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2014-03-22 16:24:44 -0700
commitace340997bfbbbae838c5f06956d06511739f37d (patch)
tree91fbf3c0a3dca0f938d294a1e4048403ddc1f194 /src/misc/vec
parentc86a13f0b56b061fd0841efd080758fc3b77c53e (diff)
downloadabc-ace340997bfbbbae838c5f06956d06511739f37d.tar.gz
abc-ace340997bfbbbae838c5f06956d06511739f37d.tar.bz2
abc-ace340997bfbbbae838c5f06956d06511739f37d.zip
Experiments with mapping.
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecFlt.h17
-rw-r--r--src/misc/vec/vecInt.h16
2 files changed, 33 insertions, 0 deletions
diff --git a/src/misc/vec/vecFlt.h b/src/misc/vec/vecFlt.h
index 57bfe3c1..8f3005a4 100644
--- a/src/misc/vec/vecFlt.h
+++ b/src/misc/vec/vecFlt.h
@@ -395,6 +395,23 @@ static inline void Vec_FltAddToEntry( Vec_Flt_t * p, int i, float Addition )
SeeAlso []
***********************************************************************/
+static inline void Vec_FltUpdateEntry( Vec_Flt_t * p, int i, float Value )
+{
+ if ( Vec_FltEntry( p, i ) < Value )
+ Vec_FltWriteEntry( p, i, Value );
+}
+
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
static inline float Vec_FltEntryLast( Vec_Flt_t * p )
{
return p->pArray[p->nSize-1];
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index f8dc9385..613b5437 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -695,6 +695,12 @@ static inline void Vec_IntPush( Vec_Int_t * p, int Entry )
}
p->pArray[p->nSize++] = Entry;
}
+static inline void Vec_IntPushArray( Vec_Int_t * p, int * pEntries, int nEntries )
+{
+ int i;
+ for ( i = 0; i < nEntries; i++ )
+ Vec_IntPush( p, pEntries[i] );
+}
/**Function*************************************************************
@@ -1293,6 +1299,16 @@ static inline int Vec_IntCheckUniqueSmall( Vec_Int_t * p )
return 0;
return 1;
}
+static inline int Vec_IntCountUnique( Vec_Int_t * p )
+{
+ int i, Count = 0, Max = Vec_IntFindMax(p);
+ unsigned char * pPres = ABC_CALLOC( unsigned char, Max+1 );
+ for ( i = 0; i < p->nSize; i++ )
+ if ( pPres[p->pArray[i]] == 0 )
+ pPres[p->pArray[i]] = 1, Count++;
+ ABC_FREE( pPres );
+ return Count;
+}
/**Function*************************************************************