From 77dbe2b6565dbc68a04a315fb51b50a35b763228 Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Sat, 31 Jan 2015 19:52:32 -0800 Subject: Major rehash of the CBA code. --- src/misc/vec/vecInt.h | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) (limited to 'src/misc/vec/vecInt.h') diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h index e37743c5..b1aa556b 100644 --- a/src/misc/vec/vecInt.h +++ b/src/misc/vec/vecInt.h @@ -65,7 +65,9 @@ struct Vec_Int_t_ for ( i = 0; (i < Vec_IntSize(vVec1)) && (((Entry1) = Vec_IntEntry(vVec1, i)), 1) && (((Entry2) = Vec_IntEntry(vVec2, i)), 1); i++ ) #define Vec_IntForEachEntryDouble( vVec, Entry1, Entry2, i ) \ for ( i = 0; (i+1 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1); i += 2 ) -#define Vec_IntForEachEntryTriple( vVec, Entry1, Entry2, Entry3, i ) \ +#define Vec_IntForEachEntryDoubleStart( vVec, Entry1, Entry2, i, Start ) \ + for ( i = Start; (i+1 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1); i += 2 ) +#define Vec_IntForEachEntryTriple( vVec, Entry1, Entry2, Entry3, i ) \ for ( i = 0; (i+2 < Vec_IntSize(vVec)) && (((Entry1) = Vec_IntEntry(vVec, i)), 1) && (((Entry2) = Vec_IntEntry(vVec, i+1)), 1) && (((Entry3) = Vec_IntEntry(vVec, i+2)), 1); i += 3 ) #define Vec_IntForEachEntryThisNext( vVec, This, Next, i ) \ for ( i = 0, (This) = (Next) = (Vec_IntSize(vVec) ? Vec_IntEntry(vVec, 0) : -1); (i+1 < Vec_IntSize(vVec)) && (((Next) = Vec_IntEntry(vVec, i+1)), 1); i += 2, (This) = (Next) ) @@ -613,6 +615,11 @@ static inline int Vec_IntGetEntry( Vec_Int_t * p, int i ) Vec_IntFillExtra( p, i + 1, 0 ); return Vec_IntEntry( p, i ); } +static inline int Vec_IntGetEntryFull( Vec_Int_t * p, int i ) +{ + Vec_IntFillExtra( p, i + 1, -1 ); + return Vec_IntEntry( p, i ); +} /**Function************************************************************* @@ -1170,6 +1177,20 @@ static inline int Vec_IntCountEntry( Vec_Int_t * p, int Entry ) Counter += (p->pArray[i] == Entry); return Counter; } +static inline int Vec_IntCountLarger( Vec_Int_t * p, int Entry ) +{ + int i, Counter = 0; + for ( i = 0; i < p->nSize; i++ ) + Counter += (p->pArray[i] > Entry); + return Counter; +} +static inline int Vec_IntCountSmaller( Vec_Int_t * p, int Entry ) +{ + int i, Counter = 0; + for ( i = 0; i < p->nSize; i++ ) + Counter += (p->pArray[i] < Entry); + return Counter; +} /**Function************************************************************* -- cgit v1.2.3