Skip to content

Commit adc2d5d

Browse files
Make convert_abs take an abs_exprt parameter
1 parent b837b8a commit adc2d5d

File tree

3 files changed

+7
-14
lines changed

3 files changed

+7
-14
lines changed

src/solvers/flattening/boolbv.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -253,7 +253,7 @@ bvt boolbvt::convert_bitvector(const exprt &expr)
253253
return convert_bitvector(expr.op0());
254254
}
255255
else if(expr.id()==ID_abs)
256-
return convert_abs(expr);
256+
return convert_abs(to_abs_expr(expr));
257257
else if(expr.id() == ID_bswap)
258258
return convert_bswap(to_bswap_expr(expr));
259259
else if(expr.id()==ID_byte_extract_little_endian ||

src/solvers/flattening/boolbv.h

+1-1
Original file line numberDiff line numberDiff line change
@@ -163,7 +163,7 @@ class boolbvt:public arrayst
163163
virtual bvt convert_shift(const binary_exprt &expr);
164164
virtual bvt convert_bitwise(const exprt &expr);
165165
virtual bvt convert_unary_minus(const unary_exprt &expr);
166-
virtual bvt convert_abs(const exprt &expr);
166+
virtual bvt convert_abs(const abs_exprt &expr);
167167
virtual bvt convert_concatenation(const exprt &expr);
168168
virtual bvt convert_replication(const replication_exprt &expr);
169169
virtual bvt convert_bv_literals(const exprt &expr);

src/solvers/flattening/boolbv_abs.cpp

+5-12
Original file line numberDiff line numberDiff line change
@@ -14,26 +14,19 @@ Author: Daniel Kroening, [email protected]
1414

1515
#include <solvers/floatbv/float_utils.h>
1616

17-
bvt boolbvt::convert_abs(const exprt &expr)
17+
bvt boolbvt::convert_abs(const abs_exprt &expr)
1818
{
19-
std::size_t width=boolbv_width(expr.type());
19+
const std::size_t width = boolbv_width(expr.type());
2020

2121
if(width==0)
2222
return conversion_failed(expr);
2323

24-
const exprt::operandst &operands=expr.operands();
24+
const bvt &op_bv=convert_bv(expr.op());
2525

26-
if(operands.size()!=1)
27-
throw "abs takes one operand";
28-
29-
const exprt &op0=expr.op0();
30-
31-
const bvt &op_bv=convert_bv(op0);
32-
33-
if(op0.type()!=expr.type())
26+
if(expr.op().type()!=expr.type())
3427
return conversion_failed(expr);
3528

36-
bvtypet bvtype=get_bvtype(expr.type());
29+
const bvtypet bvtype = get_bvtype(expr.type());
3730

3831
if(bvtype==bvtypet::IS_FIXED ||
3932
bvtype==bvtypet::IS_SIGNED ||

0 commit comments

Comments
 (0)