@@ -2136,19 +2136,19 @@ static exprt lower_byte_update(
21362136 instantiate_byte_array (value_as_byte_array, 0 , (type_bits + 7 ) / 8 , ns);
21372137 }
21382138
2139- const std::size_t update_size = update_bytes.size ();
2140- const std::size_t width = std::max (type_bits, update_size * 8 );
2139+ const std::size_t update_size_bits = update_bytes.size () * 8 ;
2140+ const std::size_t bit_width = std::max (type_bits, update_size_bits );
21412141
21422142 const bool is_little_endian = src.id () == ID_byte_update_little_endian;
21432143
21442144 exprt val_before =
21452145 typecast_exprt::conditional_cast (src.op (), bv_typet{type_bits});
2146- if (width > type_bits)
2146+ if (bit_width > type_bits)
21472147 {
21482148 val_before =
2149- concatenation_exprt{from_integer (0 , bv_typet{width - type_bits}),
2149+ concatenation_exprt{from_integer (0 , bv_typet{bit_width - type_bits}),
21502150 val_before,
2151- bv_typet{width }};
2151+ bv_typet{bit_width }};
21522152
21532153 if (!is_little_endian)
21542154 to_concatenation_expr (val_before)
@@ -2181,11 +2181,12 @@ static exprt lower_byte_update(
21812181 // build mask
21822182 exprt mask;
21832183 if (is_little_endian)
2184- mask = from_integer (power (2 , update_size * 8 ) - 1 , bv_typet{width });
2184+ mask = from_integer (power (2 , update_size_bits ) - 1 , bv_typet{bit_width });
21852185 else
21862186 {
21872187 mask = from_integer (
2188- power (2 , width) - power (2 , width - update_size * 8 ), bv_typet{width});
2188+ power (2 , bit_width) - power (2 , bit_width - update_size_bits),
2189+ bv_typet{bit_width});
21892190 }
21902191
21912192 const typet &offset_type = src.offset ().type ();
@@ -2204,17 +2205,17 @@ static exprt lower_byte_update(
22042205 bitand_exprt bitand_expr{val_before, bitnot_exprt{mask_shifted}};
22052206
22062207 // concatenate and zero-extend the value
2207- concatenation_exprt value{update_bytes, bv_typet{update_size * 8 }};
2208+ concatenation_exprt value{update_bytes, bv_typet{update_size_bits }};
22082209 if (is_little_endian)
22092210 std::reverse (value.operands ().begin (), value.operands ().end ());
22102211
22112212 exprt zero_extended;
2212- if (width > update_size * 8 )
2213+ if (bit_width > update_size_bits )
22132214 {
2214- zero_extended =
2215- concatenation_exprt{ from_integer (0 , bv_typet{width - update_size * 8 }),
2216- value,
2217- bv_typet{width }};
2215+ zero_extended = concatenation_exprt{
2216+ from_integer (0 , bv_typet{bit_width - update_size_bits }),
2217+ value,
2218+ bv_typet{bit_width }};
22182219
22192220 if (!is_little_endian)
22202221 to_concatenation_expr (zero_extended)
@@ -2234,16 +2235,18 @@ static exprt lower_byte_update(
22342235 // original_bits |= newvalue
22352236 bitor_exprt bitor_expr{bitand_expr, value_shifted};
22362237
2237- if (!is_little_endian && width > type_bits)
2238+ if (!is_little_endian && bit_width > type_bits)
22382239 {
22392240 return simplify_expr (
22402241 typecast_exprt::conditional_cast (
2241- extractbits_exprt{
2242- bitor_expr, width - 1 , width - type_bits, bv_typet{type_bits}},
2242+ extractbits_exprt{bitor_expr,
2243+ bit_width - 1 ,
2244+ bit_width - type_bits,
2245+ bv_typet{type_bits}},
22432246 src.type ()),
22442247 ns);
22452248 }
2246- else if (width > type_bits)
2249+ else if (bit_width > type_bits)
22472250 {
22482251 return simplify_expr (
22492252 typecast_exprt::conditional_cast (
0 commit comments