summaryrefslogtreecommitdiffstats
path: root/src/misc/vec/vecVec.h
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2007-04-08 08:01:00 -0700
committerAlan Mishchenko <alanmi@berkeley.edu>2007-04-08 08:01:00 -0700
commitc09d4d499cee70f02e3e9a18226554b8d1d34488 (patch)
tree89ac20b1029dc8407f655224f6ef2b5f431fa453 /src/misc/vec/vecVec.h
parent94112fd22fc6f09ccc488cfc577d43aebeff9c5f (diff)
downloadabc-c09d4d499cee70f02e3e9a18226554b8d1d34488.tar.gz
abc-c09d4d499cee70f02e3e9a18226554b8d1d34488.tar.bz2
abc-c09d4d499cee70f02e3e9a18226554b8d1d34488.zip
Version abc70408
Diffstat (limited to 'src/misc/vec/vecVec.h')
-rw-r--r--src/misc/vec/vecVec.h61
1 files changed, 61 insertions, 0 deletions
diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h
index eef33501..09e476f9 100644
--- a/src/misc/vec/vecVec.h
+++ b/src/misc/vec/vecVec.h
@@ -284,6 +284,67 @@ static inline void Vec_VecPushUnique( Vec_Vec_t * p, int Level, void * Entry )
Vec_PtrPushUnique( (Vec_Ptr_t*)p->pArray[Level], Entry );
}
+/**Function*************************************************************
+
+ Synopsis [Comparison procedure for two arrays.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Vec_VecSortCompare1( Vec_Ptr_t ** pp1, Vec_Ptr_t ** pp2 )
+{
+ if ( Vec_PtrSize(*pp1) < Vec_PtrSize(*pp2) )
+ return -1;
+ if ( Vec_PtrSize(*pp1) > Vec_PtrSize(*pp2) )
+ return 1;
+ return 0;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Comparison procedure for two integers.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Vec_VecSortCompare2( Vec_Ptr_t ** pp1, Vec_Ptr_t ** pp2 )
+{
+ if ( Vec_PtrSize(*pp1) > Vec_PtrSize(*pp2) )
+ return -1;
+ if ( Vec_PtrSize(*pp1) < Vec_PtrSize(*pp2) )
+ return 1;
+ return 0;
+}
+
+/**Function*************************************************************
+
+ Synopsis [Sorting the entries by their integer value.]
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline void Vec_VecSort( Vec_Vec_t * p, int fReverse )
+{
+ if ( fReverse )
+ qsort( (void *)p->pArray, p->nSize, sizeof(void *),
+ (int (*)(const void *, const void *)) Vec_VecSortCompare2 );
+ else
+ qsort( (void *)p->pArray, p->nSize, sizeof(void *),
+ (int (*)(const void *, const void *)) Vec_VecSortCompare1 );
+}
+
#endif
////////////////////////////////////////////////////////////////////////