From 31ebf4c81f1a953727117f734ffbd81803f6ee38 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Steffan=20S=C3=B8lvsten?= Date: Sat, 4 Nov 2023 21:52:49 +0800 Subject: [PATCH] Improve performance of 'bdd_isithvar' and 'bdd_isnithvar' based on BDD semantics --- src/adiar/bdd/pred.cpp | 12 ++++++++---- 1 file changed, 8 insertions(+), 4 deletions(-) diff --git a/src/adiar/bdd/pred.cpp b/src/adiar/bdd/pred.cpp index 2e7f858cd..60e7bfcde 100644 --- a/src/adiar/bdd/pred.cpp +++ b/src/adiar/bdd/pred.cpp @@ -45,8 +45,10 @@ namespace adiar internal::node_stream<> ns(f); const bdd::node_type root = ns.pull(); - return root.low() == bdd::node_type::pointer_type(false) - && root.high() == bdd::node_type::pointer_type(true); + adiar_assert(root.low() != root.high(), + "A reduced BDD cannot have identical children"); + + return root.high() == bdd::node_type::pointer_type(true); } bool bdd_isnithvar(const bdd& f) @@ -56,8 +58,10 @@ namespace adiar internal::node_stream<> ns(f); const bdd::node_type root = ns.pull(); - return root.low() == bdd::node_type::pointer_type(true) - && root.high() == bdd::node_type::pointer_type(false); + adiar_assert(root.low() != root.high(), + "A reduced BDD cannot have identical children"); + + return root.low() == bdd::node_type::pointer_type(true); } bool bdd_equal(const exec_policy &ep, const bdd &f, const bdd &g)