26 unsigned width_suffix=0;
29 for(
unsigned i=0; i<src.size(); i++)
33 if(ch==
'u' || ch==
'U')
35 else if(ch==
'l' || ch==
'L')
37 else if(ch==
'i' || ch==
'I')
42 if((i+1)<src.size() && isdigit(src[i+1]))
47 else if(ch==
'j' || ch==
'J')
53 if(src.size()>=2 && src[0]==
'0' && tolower(src[1])==
'x')
57 std::string without_prefix(src, 2, std::string::npos);
60 else if(src.size()>=2 && src[0]==
'0' && tolower(src[1])==
'b')
65 std::string without_prefix(src, 2, std::string::npos);
68 else if(src.size()>=2 && src[0]==
'0' && isdigit(src[1]))
88 c_type=
is_unsigned?ID_unsigned_long_int:ID_signed_long_int;
90 c_type=
is_unsigned?ID_unsigned_long_long_int:ID_signed_long_long_int;
93 is_unsigned ? ID_unsignedbv : ID_signedbv, width_suffix);
94 type.
set(ID_C_c_type, c_type);
106 bool is_hex_or_oct_or_bin=(base==8) || (base==16) || (base==2);
108 #define FITS(width, signed) \
109 ((signed?!is_unsigned:(is_unsigned || is_hex_or_oct_or_bin)) && \
110 (power(2, signed?width-1:width)>value_abs))
120 c_type=ID_signed_int;
126 c_type=ID_unsigned_int;
132 c_type=ID_signed_long_int;
139 c_type=ID_unsigned_long_int;
145 c_type=ID_signed_long_long_int;
152 c_type=ID_unsigned_long_long_int;
162 c_type=ID_unsigned_long_long_int;
165 c_type=ID_signed_long_long_int;
169 type.
set(ID_C_c_type, c_type);
181 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_namet &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?