Skip to content

Commit d10ad93

Browse files
Fix type of bddVar argument
The function bdd_variable takes a size_t for miniBdd while cudd.bddVar takes an int. We make this type dependent of the implementation by defining an indext, which will avoid having to do conversions.
1 parent 0b58dc5 commit d10ad93

File tree

2 files changed

+10
-4
lines changed

2 files changed

+10
-4
lines changed

src/solvers/bdd/bdd_cudd.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,8 +35,11 @@ class bdd_nodet
3535
return Cudd_IsComplement(node) != 0;
3636
}
3737

38+
/// Type of indexes of Boolean variables
39+
using indext = int;
40+
3841
/// Label on the node, corresponds to the index of a Boolean variable
39-
std::size_t index() const
42+
indext index() const
4043
{
4144
return Cudd_NodeReadIndex(node);
4245
}
@@ -147,7 +150,7 @@ class bdd_managert
147150
return bddt(cudd.bddZero());
148151
}
149152

150-
bddt bdd_variable(std::size_t index)
153+
bddt bdd_variable(bdd_nodet::indext index)
151154
{
152155
return bddt(cudd.bddVar(index));
153156
}

src/solvers/bdd/bdd_miniBDD.h

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,8 +39,11 @@ class bdd_nodet
3939
return node->node_number == 0;
4040
}
4141

42+
/// Type of indexes of Boolean variables
43+
using indext = std::size_t;
44+
4245
/// Label on the node, corresponds to the index of a Boolean variable
43-
std::size_t index() const
46+
indext index() const
4447
{
4548
return bdd_var_to_index.at(node->var);
4649
}
@@ -158,7 +161,7 @@ class bdd_managert : private mini_bdd_mgrt
158161
return bddt(False());
159162
}
160163

161-
bddt bdd_variable(std::size_t index)
164+
bddt bdd_variable(bdd_nodet::indext index)
162165
{
163166
auto it = index_to_bdd.find(index);
164167
if(it != index_to_bdd.end())

0 commit comments

Comments
 (0)