From 97d19a46000c24c9758b144003bf27dad4b02f98 Mon Sep 17 00:00:00 2001 From: David Allemang Date: Thu, 15 Sep 2022 10:54:55 -0400 Subject: [PATCH] simplify idem test --- tc/src/core.cpp | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/tc/src/core.cpp b/tc/src/core.cpp index 79943fa..d2a2e27 100644 --- a/tc/src/core.cpp +++ b/tc/src/core.cpp @@ -137,20 +137,20 @@ namespace tc { auto &trow = rel_tables.rows[target][table_idx]; auto &crow = rel_tables.rows[coset][table_idx]; - // Test if loop is closed Coset other_gen = (i == gen) ? j : i; + // Test if loop is closed if (trow.free) { - if (target == coset) { - trow.gnr = -1; - } - trow = crow; trow.gnr++; + if (target == coset) { + trow.idem = true; + } + if (trow.idem) { if (trow.gnr == m) { - // loop is closed, but internal, so the target links to itself via this generator. + // loop is closed, but idempotent, so the target links to itself via the other generator. // todo might be able to move this logic up into the (target == coset) block and avoid those computations. facts.push(target * ngens + other_gen); }