Skip to content

Commit 64b336a

Browse files
Refactor interval_sparse_array::concretize
1 parent 5392645 commit 64b336a

File tree

1 file changed

+7
-8
lines changed

1 file changed

+7
-8
lines changed

src/solvers/refinement/string_refinement_util.cpp

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -210,16 +210,15 @@ array_exprt interval_sparse_arrayt::concretize(
210210
array_exprt array(array_type);
211211
array.operands().reserve(size);
212212

213-
std::size_t current_index = 0;
214-
for(const auto &pair : entries)
215-
{
216-
for(; current_index <= pair.first && current_index < size; ++current_index)
217-
array.operands().push_back(pair.second);
218-
}
219-
for(; current_index < size; ++current_index)
220-
array.operands().push_back(default_value);
213+
auto it = entries.begin();
214+
for(; it != entries.end() && it->first < size; ++it)
215+
array.operands().resize(it->first + 1, it->second);
216+
217+
array.operands().resize(
218+
size, it == entries.end() ? default_value : it->second);
221219
return array;
222220
}
221+
223222
void equation_symbol_mappingt::add(const std::size_t i, const exprt &expr)
224223
{
225224
equations_containing[expr].push_back(i);

0 commit comments

Comments
 (0)