Commit a32ccd64 by Alexandre Duret-Lutz

### [buddy] slight optimization of bdd_implies

```* src/bddop.c: Avoid the first recursion when it is obvious that the
second will fail.```
parent 41866b37
 ... @@ -931,15 +931,30 @@ int bdd_implies(BDD l, BDD r) ... @@ -931,15 +931,30 @@ int bdd_implies(BDD l, BDD r) if (LEVEL(l) == LEVEL(r)) if (LEVEL(l) == LEVEL(r)) { { res = bdd_implies(LOW(l), LOW(r)) && bdd_implies(HIGH(l), HIGH(r)); int hl = HIGH(l); int hr = HIGH(r); // Avoid the recursion if the second implication will trivially // fail. if ((ISONE(hl) || ISZERO(hr)) && (hl != hr)) res = 0; else res = bdd_implies(LOW(l), LOW(r)) && bdd_implies(hl, hr); } } else if (LEVEL(l) < LEVEL(r)) else if (LEVEL(l) < LEVEL(r)) { { res = bdd_implies(LOW(l), r) && bdd_implies(HIGH(l), r); int hl = HIGH(l); if (ISONE(hl) && (hl != r)) res = 0; else res = bdd_implies(LOW(l), r) && bdd_implies(HIGH(l), r); } } else /* LEVEL(l) > LEVEL(r) */ else /* LEVEL(l) > LEVEL(r) */ { { res = bdd_implies(l, LOW(r)) && bdd_implies(l, HIGH(r)); int hr = HIGH(r); if (ISZERO(hr) && (hr != r)) res = 0; else res = bdd_implies(l, LOW(r)) && bdd_implies(l, HIGH(r)); } } entry->i.a = l; entry->i.a = l; ... ...
Supports Markdown
0% or .
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!