Skip to content

Commit b7c5af4

Browse files
author
Daniel Kroening
committed
smt2 backend: fix constants
1 parent 36768b6 commit b7c5af4

File tree

1 file changed

+4
-5
lines changed

1 file changed

+4
-5
lines changed

src/solvers/smt2/smt2_conv.cpp

Lines changed: 4 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -2710,19 +2710,18 @@ void smt2_convt::convert_constant(const constant_exprt &expr)
27102710
expr_type.id()==ID_incomplete_c_enum ||
27112711
expr_type.id()==ID_c_bit_field)
27122712
{
2713-
mp_integer value=binary2integer(id2string(expr.get_value()), false);
2713+
const std::size_t width=boolbv_width(expr_type);
27142714

2715-
std::size_t width=boolbv_width(expr_type);
2715+
const mp_integer value=bvrep2integer(expr.get_value(), width, false);
27162716

27172717
out << "(_ bv" << value
27182718
<< " " << width << ")";
27192719
}
27202720
else if(expr_type.id()==ID_fixedbv)
27212721
{
2722-
fixedbv_spect spec(to_fixedbv_type(expr_type));
2722+
const fixedbv_spect spec(to_fixedbv_type(expr_type));
27232723

2724-
std::string v_str=id2string(expr.get_value());
2725-
mp_integer v=binary2integer(v_str, false);
2724+
const mp_integer v=bvrep2integer(expr.get_value(), spec.width, false);
27262725

27272726
out << "(_ bv" << v << " " << spec.width << ")";
27282727
}

0 commit comments

Comments
 (0)