summaryrefslogtreecommitdiffstats
path: root/src/sat/bsat/vecSet.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-02-16 20:54:41 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2012-02-16 20:54:41 -0800
commit16dc02e7f6b9c22ecea2c878c9bb63d34264d378 (patch)
tree8fd7adb6c24153ea9c52d46952f31038571e4492 /src/sat/bsat/vecSet.h
parentf1dba69c576a9b995f87673ce6d6ccbaddf647b6 (diff)
downloadabc-16dc02e7f6b9c22ecea2c878c9bb63d34264d378.tar.gz
abc-16dc02e7f6b9c22ecea2c878c9bb63d34264d378.tar.bz2
abc-16dc02e7f6b9c22ecea2c878c9bb63d34264d378.zip
Improved memory management of proof-logging and propagated changes.
Diffstat (limited to 'src/sat/bsat/vecSet.h')
-rw-r--r--src/sat/bsat/vecSet.h14
1 files changed, 11 insertions, 3 deletions
diff --git a/src/sat/bsat/vecSet.h b/src/sat/bsat/vecSet.h
index e95c3332..b1c4de63 100644
--- a/src/sat/bsat/vecSet.h
+++ b/src/sat/bsat/vecSet.h
@@ -61,6 +61,7 @@ struct Vec_Set_t_
static inline int Vec_SetHandPage( int h ) { return h >> 16; }
static inline int Vec_SetHandShift( int h ) { return h & 0xFFFF; }
+static inline int Vec_SetWordNum( int nSize ) { return (nSize + 1) >> 1; }
static inline word * Vec_SetEntry( Vec_Set_t * p, int h ) { return p->pPages[Vec_SetHandPage(h)] + Vec_SetHandShift(h); }
static inline int Vec_SetEntryNum( Vec_Set_t * p ) { return p->nEntries; }
@@ -181,7 +182,7 @@ static inline void Vec_SetFree( Vec_Set_t * p )
***********************************************************************/
static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize )
{
- int nWords = (nSize + 1) >> 1;
+ int nWords = Vec_SetWordNum( nSize );
assert( nWords < 0x10000 );
p->nEntries++;
if ( Vec_SetLimit( p->pPages[p->iPage] ) + nWords > 0x10000 )
@@ -198,13 +199,13 @@ static inline int Vec_SetAppend( Vec_Set_t * p, int * pArray, int nSize )
Vec_SetWriteLimit( p->pPages[p->iPage], 1 );
}
if ( pArray )
- memmove( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * nSize );
+ memmove( p->pPages[p->iPage] + Vec_SetLimit(p->pPages[p->iPage]), pArray, sizeof(int) * nSize );
Vec_SetIncLimit( p->pPages[p->iPage], nWords );
return Vec_SetHandCurrent(p) - nWords;
}
static inline int Vec_SetAppendS( Vec_Set_t * p, int nSize )
{
- int nWords = (nSize + 1) >> 1;
+ int nWords = Vec_SetWordNum( nSize );
assert( nWords < 0x10000 );
if ( Vec_SetLimitS( p->pPages[p->iPageS] ) + nWords > 0x10000 )
Vec_SetWriteLimitS( p->pPages[++p->iPageS], 1 );
@@ -236,6 +237,13 @@ static inline void Vec_SetShrinkS( Vec_Set_t * p, int h )
Vec_SetWriteLimitS( p->pPages[p->iPageS], Vec_SetHandShift(h) );
}
+static inline void Vec_SetShrinkLimits( Vec_Set_t * p )
+{
+ int i;
+ for ( i = 0; i <= p->iPage; i++ )
+ Vec_SetWriteLimit( p->pPages[i], Vec_SetLimitS(p->pPages[i]) );
+}
+
ABC_NAMESPACE_HEADER_END