From e917dda1d363cf56274d0595c97cecf3c59eca75 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Mon, 13 Oct 2008 08:01:00 -0700 Subject: Version abc81013 --- src/misc/vec/vecInt.h | 38 ++++++++++++++++++++++++++++---------- 1 file changed, 28 insertions(+), 10 deletions(-) (limited to 'src/misc/vec/vecInt.h') diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index 437b4d8e..c944df3f 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -382,12 +382,12 @@ static inline void Vec_IntGrow( Vec_Int_t * p, int nCapMin ) SeeAlso [] ***********************************************************************/ -static inline void Vec_IntFill( Vec_Int_t * p, int nSize, int Entry ) +static inline void Vec_IntFill( Vec_Int_t * p, int nSize, int Fill ) { int i; Vec_IntGrow( p, nSize ); for ( i = 0; i < nSize; i++ ) - p->pArray[i] = Entry; + p->pArray[i] = Fill; p->nSize = nSize; } @@ -402,20 +402,40 @@ static inline void Vec_IntFill( Vec_Int_t * p, int nSize, int Entry ) SeeAlso [] ***********************************************************************/ -static inline void Vec_IntFillExtra( Vec_Int_t * p, int nSize, int Entry ) +static inline void Vec_IntFillExtra( Vec_Int_t * p, int nSize, int Fill ) { int i; if ( p->nSize >= nSize ) return; - Vec_IntGrow( p, nSize ); + if ( 2 * p->nSize > nSize ) + Vec_IntGrow( p, 2 * nSize ); + else + Vec_IntGrow( p, nSize ); for ( i = p->nSize; i < nSize; i++ ) - p->pArray[i] = Entry; + p->pArray[i] = Fill; p->nSize = nSize; } /**Function************************************************************* - Synopsis [] + Synopsis [Returns the entry even if the place not exist.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline int Vec_IntGetEntry( Vec_Int_t * p, int i ) +{ + Vec_IntFillExtra( p, i + 1, 0 ); + return Vec_IntEntry( p, i ); +} + +/**Function************************************************************* + + Synopsis [Inserts the entry even if the place does not exist.] Description [] @@ -424,11 +444,9 @@ static inline void Vec_IntFillExtra( Vec_Int_t * p, int nSize, int Entry ) SeeAlso [] ***********************************************************************/ -static inline void Vec_IntWriteEntryFill( Vec_Int_t * p, int i, int Entry ) +static inline void Vec_IntSetEntry( Vec_Int_t * p, int i, int Entry ) { - assert( i >= 0 ); - if ( i >= p->nSize ) - Vec_IntFillExtra( p, 2 * i, 0 ); + Vec_IntFillExtra( p, i + 1, 0 ); Vec_IntWriteEntry( p, i, Entry ); } -- cgit v1.2.3