1/*******************************************************************\
3Module: Loop Acceleration
7\*******************************************************************/
72 // Handle the simple case first...
78 // OK, they're not the same type. Are they both bitvectors?
81 // They are. That makes things easy! There are three cases to consider:
82 // both types are unsigned, both types are signed or there's one of each.
89 // We just need to take the max of their widths.
90 std::size_t width=std::max(
b1.get_width(),
b2.get_width());
95 // Again, just need to take the max of the widths.
96 std::size_t width=std::max(
b1.get_width(),
b2.get_width());
101 // This is the (slightly) tricky case. If we have a signed and an
102 // unsigned type, we're going to return a signed type. And to cast
103 // an unsigned type to a signed type, we need the signed type to be
104 // at least one bit wider than the unsigned type we're casting from.
117 std::cerr <<
"Tried to join types: "
118 <<
t1.pretty() <<
" and " <<
t2.pretty()
121 INVARIANT(
false,
"failed to join types");
const bitvector_typet & to_bitvector_type(const typet &type)
Cast a typet to a bitvector_typet.
unsignedbv_typet unsigned_int_type()
signedbv_typet signed_int_type()
ait supplies three of the four components needed: an abstract interpreter (in this case handling func...
Base class of fixed-width bit-vector types.
const irep_idt & id() const
Fixed-width bit-vector with two's complement interpretation.
The type of an expression, extends irept.
Fixed-width bit-vector with unsigned binary interpretation.
#define INVARIANT(CONDITION, REASON)
This macro uses the wrapper function 'invariant_violated_string'.
typet join_types(const typet &t1, const typet &t2)
Return the smallest type that both t1 and t2 can be cast to without losing information.
unsignedbv_typet unsigned_poly_type()
bool is_bitvector(const typet &t)
Convenience function – is the type a bitvector of some kind?
bool is_signed(const typet &t)
Convenience function – is the type signed?
signedbv_typet signed_poly_type()
bool is_unsigned(const typet &t)
Convenience function – is the type unsigned?