@@ -30,7 +30,7 @@ static exprt unpack_rec(
3030// / \param src: array/vector to unpack
3131// / \param src_size: array/vector size; if not a constant, \p max_bytes must be
3232// / a constant value, otherwise we fail with an exception
33- // / \param element_width : bit width of array/vector elements
33+ // / \param element_bits : bit width of array/vector elements
3434// / \param little_endian: true, iff assumed endianness is little-endian
3535// / \param offset_bytes: if not nil, bytes prior to this offset will be filled
3636// / with nil values
@@ -41,7 +41,7 @@ static exprt unpack_rec(
4141static array_exprt unpack_array_vector (
4242 const exprt &src,
4343 const exprt &src_size,
44- const mp_integer &element_width ,
44+ const mp_integer &element_bits ,
4545 bool little_endian,
4646 const exprt &offset_bytes,
4747 const exprt &max_bytes,
@@ -61,9 +61,9 @@ static array_exprt unpack_array_vector(
6161 // refine the number of elements to extract in case the element width is known
6262 // and a multiple of bytes; otherwise we will expand the entire array/vector
6363 optionalt<mp_integer> max_elements;
64- if (element_width > 0 && element_width % 8 == 0 )
64+ if (element_bits > 0 && element_bits % 8 == 0 )
6565 {
66- mp_integer el_bytes = element_width / 8 ;
66+ mp_integer el_bytes = element_bits / 8 ;
6767
6868 if (!num_elements)
6969 {
@@ -84,7 +84,7 @@ static array_exprt unpack_array_vector(
8484 }
8585
8686 // the maximum number of bytes is an upper bound in case the size of the
87- // array/vector is unknown; if the element_width was usable above this will
87+ // array/vector is unknown; if element_bits was usable above this will
8888 // have been turned into a number of elements already
8989 if (!num_elements)
9090 num_elements = *max_elements;
@@ -148,16 +148,16 @@ static exprt unpack_rec(
148148 const array_typet &array_type=to_array_type (src.type ());
149149 const typet &subtype=array_type.subtype ();
150150
151- auto element_width = pointer_offset_bits (subtype, ns);
152- CHECK_RETURN (element_width .has_value ());
151+ auto element_bits = pointer_offset_bits (subtype, ns);
152+ CHECK_RETURN (element_bits .has_value ());
153153
154- if (!unpack_byte_array && *element_width == 8 )
154+ if (!unpack_byte_array && *element_bits == 8 )
155155 return src;
156156
157157 return unpack_array_vector (
158158 src,
159159 array_type.size (),
160- *element_width ,
160+ *element_bits ,
161161 little_endian,
162162 offset_bytes,
163163 max_bytes,
@@ -168,16 +168,16 @@ static exprt unpack_rec(
168168 const vector_typet &vector_type = to_vector_type (src.type ());
169169 const typet &subtype = vector_type.subtype ();
170170
171- auto element_width = pointer_offset_bits (subtype, ns);
172- CHECK_RETURN (element_width .has_value ());
171+ auto element_bits = pointer_offset_bits (subtype, ns);
172+ CHECK_RETURN (element_bits .has_value ());
173173
174- if (!unpack_byte_array && *element_width == 8 )
174+ if (!unpack_byte_array && *element_bits == 8 )
175175 return src;
176176
177177 return unpack_array_vector (
178178 src,
179179 vector_type.size (),
180- *element_width ,
180+ *element_bits ,
181181 little_endian,
182182 offset_bytes,
183183 max_bytes,
@@ -193,14 +193,14 @@ static exprt unpack_rec(
193193 exprt::operandst byte_operands;
194194 for (const auto &comp : components)
195195 {
196- auto element_width = pointer_offset_bits (comp.type (), ns);
196+ auto component_bits = pointer_offset_bits (comp.type (), ns);
197197
198198 // the next member would be misaligned, abort
199199 if (
200- !element_width .has_value () || *element_width == 0 ||
201- *element_width % 8 != 0 )
200+ !component_bits .has_value () || *component_bits == 0 ||
201+ *component_bits % 8 != 0 )
202202 {
203- throw non_byte_alignedt (struct_type, comp, *element_width );
203+ throw non_byte_alignedt (struct_type, comp, *component_bits );
204204 }
205205
206206 exprt offset_in_member = nil_exprt ();
@@ -239,7 +239,7 @@ static exprt unpack_rec(
239239 byte_operands.insert (
240240 byte_operands.end (), sub.operands ().begin (), sub.operands ().end ());
241241
242- member_offset_bits += *element_width ;
242+ member_offset_bits += *component_bits ;
243243 }
244244
245245 const std::size_t size = byte_operands.size ();
@@ -371,25 +371,23 @@ exprt lower_byte_extract(const byte_extract_exprt &src, const namespacet &ns)
371371 const array_typet &array_type=to_array_type (src.type ());
372372 const typet &subtype=array_type.subtype ();
373373
374- auto element_width = pointer_offset_bits (subtype, ns);
374+ auto element_bits = pointer_offset_bits (subtype, ns);
375375 auto num_elements = numeric_cast<mp_integer>(array_type.size ());
376376 if (!num_elements.has_value ())
377377 num_elements = mp_integer (unpacked.op ().operands ().size ());
378378
379379 // consider ways of dealing with arrays of unknown subtype size or with a
380380 // subtype size that does not fit byte boundaries; currently we fall back to
381381 // stitching together consecutive elements down below
382- if (
383- element_width.has_value () && *element_width >= 1 &&
384- *element_width % 8 == 0 )
382+ if (element_bits.has_value () && *element_bits >= 1 && *element_bits % 8 == 0 )
385383 {
386384 array_exprt array ({}, array_type);
387385
388386 for (mp_integer i=0 ; i< *num_elements; ++i)
389387 {
390388 plus_exprt new_offset (
391389 unpacked.offset (),
392- from_integer (i * (*element_width ) / 8 , unpacked.offset ().type ()));
390+ from_integer (i * (*element_bits ) / 8 , unpacked.offset ().type ()));
393391
394392 byte_extract_exprt tmp (unpacked);
395393 tmp.type ()=subtype;
@@ -408,23 +406,21 @@ exprt lower_byte_extract(const byte_extract_exprt &src, const namespacet &ns)
408406
409407 mp_integer num_elements = numeric_cast_v<mp_integer>(vector_type.size ());
410408
411- auto element_width = pointer_offset_bits (subtype, ns);
412- CHECK_RETURN (element_width .has_value ());
409+ auto element_bits = pointer_offset_bits (subtype, ns);
410+ CHECK_RETURN (element_bits .has_value ());
413411
414412 // consider ways of dealing with vectors of unknown subtype size or with a
415413 // subtype size that does not fit byte boundaries; currently we fall back to
416414 // stitching together consecutive elements down below
417- if (
418- element_width.has_value () && *element_width >= 1 &&
419- *element_width % 8 == 0 )
415+ if (element_bits.has_value () && *element_bits >= 1 && *element_bits % 8 == 0 )
420416 {
421417 vector_exprt vector (vector_type);
422418
423419 for (mp_integer i = 0 ; i < num_elements; ++i)
424420 {
425421 plus_exprt new_offset (
426422 unpacked.offset (),
427- from_integer (i * (*element_width ) / 8 , unpacked.offset ().type ()));
423+ from_integer (i * (*element_bits ) / 8 , unpacked.offset ().type ()));
428424
429425 byte_extract_exprt tmp (unpacked);
430426 tmp.type () = subtype;
@@ -446,12 +442,12 @@ exprt lower_byte_extract(const byte_extract_exprt &src, const namespacet &ns)
446442
447443 for (const auto &comp : components)
448444 {
449- auto element_width = pointer_offset_bits (comp.type (), ns);
445+ auto component_bits = pointer_offset_bits (comp.type (), ns);
450446
451447 // the next member would be misaligned, abort
452448 if (
453- !element_width .has_value () || *element_width == 0 ||
454- *element_width % 8 != 0 )
449+ !component_bits .has_value () || *component_bits == 0 ||
450+ *component_bits % 8 != 0 )
455451 {
456452 failed=true ;
457453 break ;
0 commit comments