File tree 2 files changed +21
-0
lines changed
2 files changed +21
-0
lines changed Original file line number Diff line number Diff line change @@ -201,6 +201,24 @@ exprt interval_sparse_arrayt::at(const std::size_t index) const
201
201
return it != entries.end () ? it->second : default_value;
202
202
}
203
203
204
+ array_exprt interval_sparse_arrayt::concretize (
205
+ std::size_t size,
206
+ const typet &index_type) const
207
+ {
208
+ const array_typet array_type (
209
+ default_value.type (), from_integer (size, index_type));
210
+ array_exprt array (array_type);
211
+
212
+ std::size_t current_index = 0 ;
213
+ for (const auto &pair : entries)
214
+ {
215
+ for (; current_index <= pair.first && current_index < size; ++current_index)
216
+ array.operands ().push_back (pair.second );
217
+ }
218
+ for (; current_index < size; ++current_index)
219
+ array.operands ().push_back (default_value);
220
+ return array;
221
+ }
204
222
void equation_symbol_mappingt::add (const std::size_t i, const exprt &expr)
205
223
{
206
224
equations_containing[expr].push_back (i);
Original file line number Diff line number Diff line change @@ -141,6 +141,9 @@ class interval_sparse_arrayt final : public sparse_arrayt
141
141
static optionalt<interval_sparse_arrayt>
142
142
of_expr (const exprt &expr, const exprt &extra_value);
143
143
144
+ // / Convert to an array representation, ignores elements at index >= size
145
+ array_exprt concretize (std::size_t size, const typet &index_type) const ;
146
+
144
147
// / Get the value at the specified index.
145
148
// / Complexity is linear in the number of entries.
146
149
exprt at (std::size_t index) const override ;
You can’t perform that action at this time.
0 commit comments