20 auto const maybe_index_as_int = numeric_cast<mp_integer>(expr.
index());
24 if(!maybe_index_as_int.has_value())
27 auto index_as_int = maybe_index_as_int.value();
30 index_as_int >= 0 && index_as_int < src_bv.size(),
31 "index of extractbits must be within the bitvector",
36 index_as_int +
bv_width - 1 < src_bv.size(),
37 "index+width-1 of extractbits must be within the bitvector",
41 const std::size_t offset = numeric_cast_v<std::size_t>(index_as_int);
43 bvt result_bv(src_bv.begin() + offset, src_bv.begin() + offset +
bv_width);
API to expression classes for bitvectors.
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...
virtual bvt convert_extractbits(const extractbits_exprt &expr)
bvt conversion_failed(const exprt &expr)
Print that the expression of x has failed conversion, then return a vector of x's width.
virtual std::size_t boolbv_width(const typet &type) const
const source_locationt & find_source_location() const
Get a source_locationt from the expression or from its operands (non-recursively).
typet & type()
Return the type of the expression.
std::vector< literalt > bvt
#define DATA_INVARIANT_WITH_DIAGNOSTICS(CONDITION, REASON,...)