31 expr.
id() == ID_byte_update_little_endian ||
32 expr.
id() == ID_byte_update_big_endian);
33 const bool little_endian = expr.
id() == ID_byte_update_little_endian;
38 std::size_t update_width=value_bv.size();
41 if(update_width>bv.size())
42 update_width=bv.size();
46 const auto index = numeric_cast<mp_integer>(offset_expr);
52 if(offset+update_width>
mp_integer(bv.size()) || offset<0)
61 const std::size_t offset_i = numeric_cast_v<std::size_t>(offset);
63 for(std::size_t i = 0; i < update_width; i++)
65 size_t index_op = map_op.
map_bit(offset_i + i);
66 size_t index_value = map_value.
map_bit(i);
69 index_op < bv.size(),
"bit vector index shall be within bounds");
71 index_value < value_bv.size(),
72 "bit vector index shall be within bounds");
74 bv[index_op] = value_bv[index_value];
82 for(std::size_t offset=0; offset<bv.size(); offset+=byte_width)
92 for(std::size_t bit=0; bit<update_width; bit++)
93 if(offset+bit<bv.size())
95 std::size_t bv_o=map_op.
map_bit(offset+bit);
96 std::size_t value_bv_o=map_value.
map_bit(bit);
98 bv[bv_o]=
prop.
lselect(equal, value_bv[value_bv_o], bv[bv_o]);
Expression classes for byte-level operators.
exprt lower_byte_update(const byte_update_exprt &src, const namespacet &ns)
Rewrite a byte update expression to more fundamental operations.
virtual const bvt & convert_bv(const exprt &expr, const std::optional< std::size_t > expected_width={})
Convert expression to vector of literalts, using an internal cache to speed up conversion if availabl...
bool is_unbounded_array(const typet &type) const override
virtual bvt convert_byte_update(const byte_update_exprt &expr)
virtual endianness_mapt endianness_map(const typet &type, bool little_endian) const
Expression corresponding to op() where the bytes starting at position offset (given in number of byte...
const exprt & value() const
const exprt & offset() const
std::size_t get_bits_per_byte() const
Maps a big-endian offset to a little-endian offset.
size_t map_bit(size_t bit) const
virtual literalt equality(const exprt &e1, const exprt &e2)
Base class for all expressions.
typet & type()
Return the type of the expression.
const irep_idt & id() const
literalt convert(const exprt &expr) override
Convert a Boolean expression and return the corresponding literal.
virtual literalt lselect(literalt a, literalt b, literalt c)=0
std::vector< literalt > bvt
#define PRECONDITION(CONDITION)