Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
10 changes: 8 additions & 2 deletions src/util/arith_tools.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -31,8 +31,7 @@
return false;
}
}
else if(type_id==ID_integer ||
type_id==ID_natural)
else if(type_id == ID_integer || type_id == ID_natural || type_id == ID_range)
{
int_value=string2integer(id2string(value));
return false;
Expand Down Expand Up @@ -112,6 +111,13 @@
PRECONDITION(int_value >= 0);
return constant_exprt(integer2string(int_value), type);
}
else if(type_id == ID_range)
{
auto &range_type = to_range_type(type);
PRECONDITION(int_value >= range_type.get_from());
PRECONDITION(int_value <= range_type.get_to());
return constant_exprt{integer2string(int_value), type};

Check warning on line 119 in src/util/arith_tools.cpp

View check run for this annotation

Codecov / codecov/patch

src/util/arith_tools.cpp#L116-L119

Added lines #L116 - L119 were not covered by tests
}
else if(type_id==ID_unsignedbv)
{
std::size_t width=to_unsignedbv_type(type).get_width();
Expand Down
Loading