Skip to content

Commit 9dbbada

Browse files
authored
Merge pull request #8396 from diffblue/range-add-sub
implement flattening for +/- for the range type
2 parents bf58af8 + 1a020c4 commit 9dbbada

File tree

1 file changed

+9
-0
lines changed

1 file changed

+9
-0
lines changed

src/solvers/flattening/boolbv_add_sub.cpp

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -124,6 +124,15 @@ bvt boolbvt::convert_add_sub(const exprt &expr)
124124
}
125125
}
126126
}
127+
else if(type.id() == ID_range)
128+
{
129+
// add: lhs + from + rhs + from - from = lhs + rhs + from
130+
// sub: lhs + from - (rhs + from) - from = lhs - rhs - from
131+
mp_integer from = to_range_type(type).get_from();
132+
bv = bv_utils.add_sub(bv, op, subtract);
133+
bv = bv_utils.add_sub(
134+
bv, bv_utils.build_constant(from, op.size()), subtract);
135+
}
127136
else if(type.id()==ID_floatbv)
128137
{
129138
// needs to change due to rounding mode

0 commit comments

Comments
 (0)