25 unsigned width_suffix=0;
28 for(
unsigned i=0; i<src.size(); i++)
32 if(ch==
'u' || ch==
'U')
34 else if(ch==
'l' || ch==
'L')
36 else if(ch==
'i' || ch==
'I')
41 if((i+1)<src.size() &&
isdigit(src[i+1]))
46 else if(ch==
'j' || ch==
'J')
52 if(src.size()>=2 && src[0]==
'0' &&
tolower(src[1])==
'x')
56 std::string without_prefix(src, 2, std::string::npos);
59 else if(src.size()>=2 && src[0]==
'0' &&
tolower(src[1])==
'b')
64 std::string without_prefix(src, 2, std::string::npos);
67 else if(src.size()>=2 && src[0]==
'0' &&
isdigit(src[1]))
87 c_type=
is_unsigned?ID_unsigned_long_int:ID_signed_long_int;
89 c_type=
is_unsigned?ID_unsigned_long_long_int:ID_signed_long_long_int;
92 is_unsigned ? ID_unsignedbv : ID_signedbv, width_suffix);
93 type.
set(ID_C_c_type, c_type);
105 bool is_hex_or_oct_or_bin=(base==8) || (base==16) || (base==2);
107 #define FITS(width, signed) \
108 ((signed?!is_unsigned:(is_unsigned || is_hex_or_oct_or_bin)) && \
109 (power(2, signed?width-1:width)>value_abs))
119 c_type=ID_signed_int;
125 c_type=ID_unsigned_int;
131 c_type=ID_signed_long_int;
138 c_type=ID_unsigned_long_int;
144 c_type=ID_signed_long_long_int;
151 c_type=ID_unsigned_long_long_int;
161 c_type=ID_unsigned_long_long_int;
164 c_type=ID_signed_long_long_int;
168 type.
set(ID_C_c_type, c_type);
180 result.
set(ID_C_base, base);
Base class of fixed-width bit-vector types.
Complex constructor from a pair of numbers.
Complex numbers made of pair of given subtype.
struct configt::ansi_ct ansi_c
dstringt has one field, an unsigned integer no which is an index into a static table of strings.
Base class for all expressions.
void set(const irep_idt &name, const irep_idt &value)
#define FITS(width, signed)
exprt convert_integer_literal(const std::string &src)
const mp_integer string2integer(const std::string &n, unsigned base)
API to expression classes.
unsigned unsafe_string2unsigned(const std::string &str, int base)
std::size_t long_long_int_width
std::size_t long_int_width
bool is_signed(const typet &t)
Convenience function – is the type signed?
bool is_unsigned(const typet &t)
Convenience function – is the type unsigned?