summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2015-08-09 13:18:22 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2015-08-09 13:18:22 -0700
commit6a4e94e74de5158280ca6959b17c2c86db1299a4 (patch)
treec2c364976a541b936a28895d4645e0461ad683fb /src/misc/vec
parent356217eff7416606ebbcf739dbd999ba6b2db299 (diff)
downloadabc-6a4e94e74de5158280ca6959b17c2c86db1299a4.tar.gz
abc-6a4e94e74de5158280ca6959b17c2c86db1299a4.tar.bz2
abc-6a4e94e74de5158280ca6959b17c2c86db1299a4.zip
Improvements to Cba data-structure.
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecHash.h18
1 files changed, 16 insertions, 2 deletions
diff --git a/src/misc/vec/vecHash.h b/src/misc/vec/vecHash.h
index cdccb308..9945024c 100644
--- a/src/misc/vec/vecHash.h
+++ b/src/misc/vec/vecHash.h
@@ -53,6 +53,7 @@ struct Hash_IntMan_t_
{
Vec_Int_t * vTable; // hash table
Vec_Int_t * vObjs; // hash objects
+ int nRefs; // reference counter for the manager
};
////////////////////////////////////////////////////////////////////////
@@ -74,7 +75,7 @@ static inline void Hash_Int2ObjSetData2( Hash_IntMan_t * p, int i, in
/**Function*************************************************************
- Synopsis [Hashing data entries composed of nSize integers.]
+ Synopsis [Hashes pairs of intergers.]
Description []
@@ -90,6 +91,7 @@ static inline Hash_IntMan_t * Hash_IntManStart( int nSize )
p->vTable = Vec_IntStart( Abc_PrimeCudd(nSize) );
p->vObjs = Vec_IntAlloc( 4*nSize );
Vec_IntFill( p->vObjs, 4, 0 );
+ p->nRefs = 1;
return p;
}
static inline void Hash_IntManStop( Hash_IntMan_t * p )
@@ -98,6 +100,18 @@ static inline void Hash_IntManStop( Hash_IntMan_t * p )
Vec_IntFree( p->vTable );
ABC_FREE( p );
}
+static inline Hash_IntMan_t * Hash_IntManRef( Hash_IntMan_t * p )
+{
+ p->nRefs++;
+ return p;
+}
+static inline void Hash_IntManDeref( Hash_IntMan_t * p )
+{
+ if ( p == NULL )
+ return;
+ if ( --p->nRefs == 0 )
+ Hash_IntManStop( p );
+}
static inline int Hash_IntManEntryNum( Hash_IntMan_t * p )
{
return Vec_IntSize(p->vObjs)/4 - 1;
@@ -172,7 +186,7 @@ static inline int Hash_Int2ManInsert( Hash_IntMan_t * p, int iData0, int iData1,
/**Function*************************************************************
- Synopsis []
+ Synopsis [Hashes triples of intergers.]
Description []