@@ -2136,19 +2136,19 @@ static exprt lower_byte_update(
2136
2136
instantiate_byte_array (value_as_byte_array, 0 , (type_bits + 7 ) / 8 , ns);
2137
2137
}
2138
2138
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 );
2141
2141
2142
2142
const bool is_little_endian = src.id () == ID_byte_update_little_endian;
2143
2143
2144
2144
exprt val_before =
2145
2145
typecast_exprt::conditional_cast (src.op (), bv_typet{type_bits});
2146
- if (width > type_bits)
2146
+ if (bit_width > type_bits)
2147
2147
{
2148
2148
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}),
2150
2150
val_before,
2151
- bv_typet{width }};
2151
+ bv_typet{bit_width }};
2152
2152
2153
2153
if (!is_little_endian)
2154
2154
to_concatenation_expr (val_before)
@@ -2181,11 +2181,12 @@ static exprt lower_byte_update(
2181
2181
// build mask
2182
2182
exprt mask;
2183
2183
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 });
2185
2185
else
2186
2186
{
2187
2187
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});
2189
2190
}
2190
2191
2191
2192
const typet &offset_type = src.offset ().type ();
@@ -2204,17 +2205,17 @@ static exprt lower_byte_update(
2204
2205
bitand_exprt bitand_expr{val_before, bitnot_exprt{mask_shifted}};
2205
2206
2206
2207
// 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 }};
2208
2209
if (is_little_endian)
2209
2210
std::reverse (value.operands ().begin (), value.operands ().end ());
2210
2211
2211
2212
exprt zero_extended;
2212
- if (width > update_size * 8 )
2213
+ if (bit_width > update_size_bits )
2213
2214
{
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 }};
2218
2219
2219
2220
if (!is_little_endian)
2220
2221
to_concatenation_expr (zero_extended)
@@ -2234,16 +2235,18 @@ static exprt lower_byte_update(
2234
2235
// original_bits |= newvalue
2235
2236
bitor_exprt bitor_expr{bitand_expr, value_shifted};
2236
2237
2237
- if (!is_little_endian && width > type_bits)
2238
+ if (!is_little_endian && bit_width > type_bits)
2238
2239
{
2239
2240
return simplify_expr (
2240
2241
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}},
2243
2246
src.type ()),
2244
2247
ns);
2245
2248
}
2246
- else if (width > type_bits)
2249
+ else if (bit_width > type_bits)
2247
2250
{
2248
2251
return simplify_expr (
2249
2252
typecast_exprt::conditional_cast (
0 commit comments