File tree 2 files changed +23
-0
lines changed 2 files changed +23
-0
lines changed Original file line number Diff line number Diff line change @@ -140,6 +140,24 @@ exprt interval_sparse_arrayt::to_if_expression(const exprt &index) const
140
140
});
141
141
}
142
142
143
+ interval_sparse_arrayt::interval_sparse_arrayt (
144
+ const array_exprt &expr,
145
+ const exprt &extra_value)
146
+ : sparse_arrayt(extra_value)
147
+ {
148
+ const auto &operands = expr.operands ();
149
+ exprt last_added = extra_value;
150
+ for (std::size_t i = 0 ; i < operands.size (); ++i)
151
+ {
152
+ const std::size_t index = operands.size () - 1 - i;
153
+ if (operands[index ].id () != ID_unknown && operands[index ] != last_added)
154
+ {
155
+ entries[index ] = operands[index ];
156
+ last_added = operands[index ];
157
+ }
158
+ }
159
+ }
160
+
143
161
void equation_symbol_mappingt::add (const std::size_t i, const exprt &expr)
144
162
{
145
163
equations_containing[expr].push_back (i);
Original file line number Diff line number Diff line change @@ -119,6 +119,11 @@ class interval_sparse_arrayt final : public sparse_arrayt
119
119
{
120
120
}
121
121
122
+ // / Initialize an array expression to sparse array representation, avoiding
123
+ // / repetition of identical successive values and setting the default to
124
+ // / `extra_value`.
125
+ interval_sparse_arrayt (const array_exprt &expr, const exprt &extra_value);
126
+
122
127
exprt to_if_expression (const exprt &index) const override ;
123
128
};
124
129
You can’t perform that action at this time.
0 commit comments