@@ -67,9 +67,7 @@ bvt boolbvt::convert_index(const index_exprt &expr)
6767 else
6868 {
6969 // free variables
70- bv.reserve (width);
71- for (std::size_t i = 0 ; i < width; i++)
72- bv.push_back (prop.new_variable ());
70+ bv = prop.new_variables (width);
7371
7472 record_array_index (expr);
7573
@@ -219,10 +217,7 @@ bvt boolbvt::convert_index(const index_exprt &expr)
219217 if (prop.has_set_to ())
220218 {
221219 // free variables
222-
223- bv.resize (width);
224- for (std::size_t i=0 ; i<width; i++)
225- bv[i]=prop.new_variable ();
220+ bv = prop.new_variables (width);
226221
227222 // add implications
228223
@@ -297,9 +292,6 @@ bvt boolbvt::convert_index(
297292 if (width==0 )
298293 return conversion_failed (array);
299294
300- bvt bv;
301- bv.resize (width);
302-
303295 // TODO: If the underlying array can use one of the
304296 // improvements given above then it may be better to use
305297 // the array theory for short chains of updates and then
@@ -325,8 +317,8 @@ bvt boolbvt::convert_index(
325317 // array.id()!=ID_array);
326318 // If not there are large improvements possible as above
327319
328- for ( std::size_t i= 0 ; i<width; i++)
329- bv[i] = tmp[numeric_cast_v<std:: size_t >(offset + i)] ;
320+ std::size_t offset_int = numeric_cast_v<std:: size_t >(offset);
321+ return bvt (tmp. begin () + offset_int, tmp. begin () + offset_int + width) ;
330322 }
331323 else if (
332324 array.id () == ID_member || array.id () == ID_index ||
@@ -354,9 +346,6 @@ bvt boolbvt::convert_index(
354346 else
355347 {
356348 // out of bounds
357- for (std::size_t i=0 ; i<width; i++)
358- bv[i]=prop.new_variable ();
349+ return prop.new_variables (width);
359350 }
360-
361- return bv;
362351}
0 commit comments