Skip to content

Commit e61d211

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 e61d211

File tree

2 files changed

+13
-5
lines changed

2 files changed

+13
-5
lines changed

src/solvers/bdd/bdd_cudd.h

Lines changed: 8 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,9 @@ Author: Romain Brenguier, [email protected]
1515
#ifndef CPROVER_SOLVERS_BDD_BDD_CUDD_H
1616
#define CPROVER_SOLVERS_BDD_BDD_CUDD_H
1717

18-
#include <cplusplus/cuddObj.hh>
18+
#include <cplusplus/cuddObj.hh>s
19+
20+
#include <util/arith_tools.h>
1921

2022
class bdd_managert;
2123
class bddt;
@@ -35,8 +37,11 @@ class bdd_nodet
3537
return Cudd_IsComplement(node) != 0;
3638
}
3739

40+
/// Type of indexes of Boolean variables
41+
using indext = int;
42+
3843
/// Label on the node, corresponds to the index of a Boolean variable
39-
std::size_t index() const
44+
indext index() const
4045
{
4146
return Cudd_NodeReadIndex(node);
4247
}
@@ -147,7 +152,7 @@ class bdd_managert
147152
return bddt(cudd.bddZero());
148153
}
149154

150-
bddt bdd_variable(std::size_t index)
155+
bddt bdd_variable(bdd_nodet::indext index)
151156
{
152157
return bddt(cudd.bddVar(index));
153158
}

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)