Skip to content

Commit 9399f65

Browse files
Use src/index instead of operand position in boolbv_extractbit
1 parent ca235a9 commit 9399f65

File tree

1 file changed

+9
-13
lines changed

1 file changed

+9
-13
lines changed

src/solvers/flattening/boolbv_extractbit.cpp

Lines changed: 9 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -17,19 +17,14 @@ Author: Daniel Kroening, [email protected]
1717

1818
literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
1919
{
20-
const exprt::operandst &operands=expr.operands();
21-
22-
if(operands.size()!=2)
23-
throw "extractbit takes two operands";
24-
25-
const bvt &bv0=convert_bv(operands[0]);
20+
const bvt &bv0 = convert_bv(expr.src());
2621

2722
// constant?
28-
if(operands[1].is_constant())
23+
if(expr.index().is_constant())
2924
{
3025
mp_integer o;
3126

32-
if(to_integer(operands[1], o))
27+
if(to_integer(expr.index(), o))
3328
throw "extractbit failed to convert constant index";
3429

3530
if(o<0 || o>=bv0.size())
@@ -38,16 +33,17 @@ literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
3833
return bv0[integer2size_t(o)];
3934
}
4035

41-
if(operands[0].type().id()==ID_verilog_signedbv ||
42-
operands[0].type().id()==ID_verilog_unsignedbv)
36+
if(
37+
expr.src().type().id() == ID_verilog_signedbv ||
38+
expr.src().type().id() == ID_verilog_unsignedbv)
4339
{
4440
// TODO
4541
assert(false);
4642
}
4743
else
4844
{
49-
std::size_t width_op0=boolbv_width(operands[0].type());
50-
std::size_t width_op1=boolbv_width(operands[1].type());
45+
std::size_t width_op0 = boolbv_width(expr.src().type());
46+
std::size_t width_op1 = boolbv_width(expr.index().type());
5147

5248
if(width_op0==0 || width_op1==0)
5349
return SUB::convert_rest(expr);
@@ -56,7 +52,7 @@ literalt boolbvt::convert_extractbit(const extractbit_exprt &expr)
5652
unsignedbv_typet index_type(index_width);
5753

5854
equal_exprt equality;
59-
equality.lhs()=operands[1]; // index operand
55+
equality.lhs() = expr.index(); // index operand
6056

6157
if(index_type!=equality.lhs().type())
6258
equality.lhs().make_typecast(index_type);

0 commit comments

Comments
 (0)