@@ -128,16 +128,16 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
128
128
const array_typet &array_type=to_array_type (type);
129
129
std::size_t sub_width=operator ()(array_type.subtype ());
130
130
131
- mp_integer array_size;
131
+ const auto array_size = numeric_cast<mp_integer>(array_type. size ()) ;
132
132
133
- if (to_integer (array_type. size (), array_size ))
133
+ if (!array_size. has_value ( ))
134
134
{
135
135
// we can still use the theory of arrays for this
136
136
entry.total_width =0 ;
137
137
}
138
138
else
139
139
{
140
- mp_integer total= array_size* sub_width;
140
+ mp_integer total = * array_size * sub_width;
141
141
if (total>(1 <<30 )) // realistic limit
142
142
throw analysis_exceptiont (" array too large for flattening" );
143
143
@@ -149,21 +149,13 @@ const boolbv_widtht::entryt &boolbv_widtht::get_entry(const typet &type) const
149
149
const vector_typet &vector_type=to_vector_type (type);
150
150
std::size_t sub_width=operator ()(vector_type.subtype ());
151
151
152
- mp_integer vector_size;
152
+ const auto vector_size = numeric_cast_v<mp_integer>(vector_type. size ()) ;
153
153
154
- if (to_integer (vector_type.size (), vector_size))
155
- {
156
- // we can still use the theory of arrays for this
157
- entry.total_width =0 ;
158
- }
159
- else
160
- {
161
- mp_integer total=vector_size*sub_width;
162
- if (total>(1 <<30 )) // realistic limit
163
- analysis_exceptiont (" vector too large for flattening" );
154
+ mp_integer total = vector_size * sub_width;
155
+ if (total > (1 << 30 )) // realistic limit
156
+ analysis_exceptiont (" vector too large for flattening" );
164
157
165
- entry.total_width = numeric_cast_v<std::size_t >(vector_size * sub_width);
166
- }
158
+ entry.total_width = numeric_cast_v<std::size_t >(vector_size * sub_width);
167
159
}
168
160
else if (type_id==ID_complex)
169
161
{
0 commit comments