32 const std::size_t new_width = numeric_cast_v<std::size_t>(
power(2, bits));
33 const bool need_typecast =
34 new_width > *x_width || x.
type().
id() != ID_unsignedbv;
39 for(std::size_t shift = 1; shift < new_width; shift <<= 1)
46 std::string bitstring;
47 bitstring.reserve(new_width);
48 for(std::size_t i = 0; i < new_width / (2 * shift); ++i)
49 bitstring += std::string(shift,
'0') + std::string(shift,
'1');
Fixed-width bit-vector with unsigned binary interpretation.
const mp_integer binary2integer(const std::string &n, bool is_signed)
convert binary string representation to mp_integer
typet & type()
Return the type of the expression.
A constant literal expression.
#define CHECK_RETURN(CONDITION)
exprt lower_popcount(const popcount_exprt &expr, const namespacet &ns)
Lower a popcount_exprt to arithmetic and logic expressions.
const irep_idt & id() const
API to expression classes.
A namespacet is essentially one or two symbol tables bound together, to allow for symbol lookups in t...
The plus expression Associativity is not specified.
The popcount (counting the number of bits set to 1) expression.
Base class for all expressions.
optionalt< mp_integer > pointer_offset_bits(const typet &type, const namespacet &ns)
void make_typecast(const typet &_type)
Create a typecast_exprt to the given type.