/* * Testbeispiel: Pfadsuche */ #include "sw_config.h" #if defined( INCLUDE_UNIT_TESTS ) || defined( DOXYGEN ) #include "eg_main_control_private.h" #include "unity_fixture.h" #include #include /**Zweier-Logarithmus (32 Bit) */ static_inline uint8_t log2_u32(uint32_t a) { if( a == 0 ) return 0; else return 31-__builtin_clzl(a); } /** Adjazenzmatrix aus Knotenliste erstellen * * @param[out] Adj: Adjazenzmatrix, Array-Index Quellknoten, Bit-Position ist Zielknoten * @param[in] nNode: Anzahl der Knoten * @param[in] vertices[]: Kantenliste (gerichtet) * @param[in] nVert: Laenge der Kantenliste */ void adjacenceMatrix(uint32_t *Adj, uint8_t nNode, uint8_t vertices[][2], uint8_t nVertices) { assert( Adj != NULL ); /* Adjazenzmatrix ist 32 Bit breit, das begrenzt die Anzahl der erlaubten Zustaende */ assert(nNode <= 32); /* Nullen */ for( int i=0; i nNode) || (dst > nNode ) ) { error("Index exceeds matrix dimensions."); } *(Adj+src) |= 1U<