From 97a2e6f29e473cc9a50ec886f9933a8060d6474e Mon Sep 17 00:00:00 2001 From: Alan Mishchenko Date: Fri, 17 Feb 2012 19:04:28 -0800 Subject: Isomorphism checking code. --- src/misc/vec/vecVec.h | 61 +++++++++++++++++++++++++++++++++++++++++++++++++++ 1 file changed, 61 insertions(+) (limited to 'src/misc/vec') diff --git a/src/misc/vec/vecVec.h b/src/misc/vec/vecVec.h index e0f18983..8bed4574 100644 --- a/src/misc/vec/vecVec.h +++ b/src/misc/vec/vecVec.h @@ -586,6 +586,67 @@ static inline void Vec_VecSort( Vec_Vec_t * p, int fReverse ) (int (*)(const void *, const void *)) Vec_VecSortCompare1 ); } +/**Function************************************************************* + + Synopsis [Comparison procedure for two integers.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static int Vec_VecSortCompare3( Vec_Int_t ** pp1, Vec_Int_t ** pp2 ) +{ + if ( Vec_IntEntry(*pp1,0) < Vec_IntEntry(*pp2,0) ) + return -1; + if ( Vec_IntEntry(*pp1,0) > Vec_IntEntry(*pp2,0) ) + return 1; + return 0; +} + +/**Function************************************************************* + + Synopsis [Comparison procedure for two integers.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static int Vec_VecSortCompare4( Vec_Int_t ** pp1, Vec_Int_t ** pp2 ) +{ + if ( Vec_IntEntry(*pp1,0) > Vec_IntEntry(*pp2,0) ) + return -1; + if ( Vec_IntEntry(*pp1,0) < Vec_IntEntry(*pp2,0) ) + return 1; + return 0; +} + +/**Function************************************************************* + + Synopsis [Sorting the entries by their integer value.] + + Description [] + + SideEffects [] + + SeeAlso [] + +***********************************************************************/ +static inline void Vec_VecSortByFirstInt( Vec_Vec_t * p, int fReverse ) +{ + if ( fReverse ) + qsort( (void *)p->pArray, p->nSize, sizeof(void *), + (int (*)(const void *, const void *)) Vec_VecSortCompare4 ); + else + qsort( (void *)p->pArray, p->nSize, sizeof(void *), + (int (*)(const void *, const void *)) Vec_VecSortCompare3 ); +} + /**Function************************************************************* Synopsis [] -- cgit v1.2.3