int nc_create_arc (struct al * src_post, struct al * dst_pre, void * src, void * dst) { if (al_test (src_post, dst)) return 0; al_add (src_post, dst); al_add (dst_pre, src); return 1; }
/** Performs all tests of the util library */ static void test_util() { int i; say( L"Testing utility library" ); for( i=0; i<18; i++ ) { long t1, t2; pq_test( 1<<i ); stack_test( 1<<i ); t1 = get_time(); hash_test( 1<<i ); t2 = get_time(); if( i > 8 ) say( L"Hashtable uses %f microseconds per element at size %d", ((double)(t2-t1))/(1<<i), 1<<i ); al_test( 1<<i ); } sb_test(); /* int i; for( i=2; i<10000000; i*=2 ) { printf( "%d", i ); t1 = get_time(); if(!hash_test(i)) exit(0); t2 = get_time(); printf( " %d\n", (t2-t1)/i ); } */ }
static void _pe_comb_init (struct ec *r, struct place *p, struct trans *t, int ispre) { int i, m, idx; int bits; struct place *pp; struct ec *rp; DPRINT (" Explore %s (%s", t->name, p->name); ASSERT (pe.comb.tab); ASSERT (r->c->fp == p); ASSERT (al_test (&t->pre, p) || al_test (&t->cont, p)); m = ++u.mark; ASSERT (m > 0); pe.comb.size = 0; pe.comb.ispre = ispre; pe.comb.r = r; pe.comb.t = t; for (i = t->pre.deg - 1; i >= 0; i--) { pp = (struct place *) t->pre.adj[i]; if (pp == p) continue; pp->m = m; pp->comb_idx = pe.comb.size; pe.comb.tab[pe.comb.size].nr = 0; pe.comb.tab[pe.comb.size].ispre = 1; pe.comb.size++; DPRINT (" %s", pp->name); } for (i = t->cont.deg - 1; i >= 0; i--) { pp = (struct place *) t->cont.adj[i]; if (pp == p) continue; pp->m = m; pp->comb_idx = pe.comb.size; pe.comb.tab[pe.comb.size].nr = 0; pe.comb.tab[pe.comb.size].ispre = 0; pe.comb.size++; DPRINT (" %s", pp->name); } DPRINT (")\n"); for (i = r->co.deg - 1; i >= 0; i--) { rp = (struct ec *) r->co.adj[i]; bits = EC_BITS (rp); rp = EC_PTR (rp); if (rp->c->fp->m != m) continue; if (ispre && ! EC_BIT0 (bits)) continue; idx = rp->c->fp->comb_idx; if (pe.comb.tab[idx].ispre) { if (EC_BIT1 (bits)) { _pe_comb_ent_add (idx, rp); } } else { if (EC_ISGEN (rp)) { _pe_comb_ent_add (idx, rp); } } } _pe_comb_sort (); }