summaryrefslogtreecommitdiffstats
path: root/src/misc/vec
diff options
context:
space:
mode:
authorAlan Mishchenko <alanmi@berkeley.edu>2012-02-11 00:22:05 -0800
committerAlan Mishchenko <alanmi@berkeley.edu>2012-02-11 00:22:05 -0800
commitc5067f7d04dc4c8ee919d9597a4a94a5c4ac3552 (patch)
tree38df5a3e37ebcfbee9bdf7db09e19c0c74df9f73 /src/misc/vec
parent71891354b4263ceefba38bf9e882dad8117256f5 (diff)
downloadabc-c5067f7d04dc4c8ee919d9597a4a94a5c4ac3552.tar.gz
abc-c5067f7d04dc4c8ee919d9597a4a94a5c4ac3552.tar.bz2
abc-c5067f7d04dc4c8ee919d9597a4a94a5c4ac3552.zip
Graph isomorphism checking code.
Diffstat (limited to 'src/misc/vec')
-rw-r--r--src/misc/vec/vecInt.h20
-rw-r--r--src/misc/vec/vecStr.h20
2 files changed, 40 insertions, 0 deletions
diff --git a/src/misc/vec/vecInt.h b/src/misc/vec/vecInt.h
index be54e583..39ab2623 100644
--- a/src/misc/vec/vecInt.h
+++ b/src/misc/vec/vecInt.h
@@ -1259,6 +1259,26 @@ static inline void Vec_IntPrint( Vec_Int_t * vVec )
printf( " }\n" );
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Vec_IntCompareVec( Vec_Int_t * p1, Vec_Int_t * p2 )
+{
+ if ( p1 == NULL || p2 == NULL )
+ return (p1 != NULL) - (p2 != NULL);
+ if ( Vec_IntSize(p1) != Vec_IntSize(p2) )
+ return Vec_IntSize(p1) - Vec_IntSize(p2);
+ return memcmp( Vec_IntArray(p1), Vec_IntArray(p2), sizeof(int)*Vec_IntSize(p1) );
+}
+
ABC_NAMESPACE_HEADER_END
diff --git a/src/misc/vec/vecStr.h b/src/misc/vec/vecStr.h
index cec3e7e1..c794dc2f 100644
--- a/src/misc/vec/vecStr.h
+++ b/src/misc/vec/vecStr.h
@@ -650,6 +650,26 @@ static inline void Vec_StrSort( Vec_Str_t * p, int fReverse )
(int (*)(const void *, const void *)) Vec_StrSortCompare1 );
}
+/**Function*************************************************************
+
+ Synopsis []
+
+ Description []
+
+ SideEffects []
+
+ SeeAlso []
+
+***********************************************************************/
+static inline int Vec_StrCompareVec( Vec_Str_t * p1, Vec_Str_t * p2 )
+{
+ if ( p1 == NULL || p2 == NULL )
+ return (p1 != NULL) - (p2 != NULL);
+ if ( Vec_StrSize(p1) != Vec_StrSize(p2) )
+ return Vec_StrSize(p1) - Vec_StrSize(p2);
+ return memcmp( Vec_StrArray(p1), Vec_StrArray(p2), Vec_StrSize(p1) );
+}
+
ABC_NAMESPACE_HEADER_END