Skip to content

Commit 92bb662

Browse files
committed
use std::size_t
1 parent 06193a6 commit 92bb662

File tree

8 files changed

+40
-39
lines changed

8 files changed

+40
-39
lines changed

src/solvers/flattening/bv_pointers.cpp

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -688,7 +688,7 @@ void bv_pointerst::encode(std::size_t addr, bvt &bv)
688688

689689
// set variable part
690690
for(std::size_t i=0; i<object_bits; i++)
691-
bv[offset_bits+i]=const_literal((addr&(1<<i))!=0);
691+
bv[offset_bits+i]=const_literal((addr&(std::size_t(1)<<i))!=0);
692692
}
693693

694694
/*******************************************************************\

src/solvers/prop/minimize.cpp

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,8 @@ void prop_minimizet::operator()()
136136
// we need to use assumptions
137137
assert(prop_conv.has_set_assumptions());
138138

139-
_iterations=_number_satisfied=0;
139+
_iterations=0;
140+
_number_satisfied=0;
140141
_value=0;
141142
bool last_was_SAT=false;
142143

src/solvers/refinement/bv_refinement.h

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,12 +45,12 @@ class bv_refinementt:public bv_pointerst
4545
struct approximationt
4646
{
4747
public:
48-
explicit approximationt(unsigned _id_nr):id_nr(_id_nr)
48+
explicit approximationt(std::size_t _id_nr):id_nr(_id_nr)
4949
{
5050
}
5151

5252
exprt expr;
53-
unsigned no_operands;
53+
std::size_t no_operands;
5454

5555
bvt op0_bv, op1_bv, op2_bv, result_bv;
5656
mp_integer op0_value, op1_value, op2_value, result_value;
@@ -70,7 +70,7 @@ class bv_refinementt:public bv_pointerst
7070
void add_over_assumption(literalt l);
7171
void add_under_assumption(literalt l);
7272

73-
unsigned id_nr;
73+
std::size_t id_nr;
7474
};
7575

7676
typedef std::list<approximationt> approximationst;

src/util/ieee_float.cpp

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -106,7 +106,7 @@ Function: ieee_float_spect::from_type
106106

107107
void ieee_float_spect::from_type(const floatbv_typet &type)
108108
{
109-
unsigned width=type.get_width();
109+
std::size_t width=type.get_width();
110110
f=type.get_f();
111111
assert(f!=0);
112112
assert(f<width);
@@ -223,7 +223,7 @@ Function: ieee_floatt::to_string_decimal
223223
224224
\*******************************************************************/
225225

226-
std::string ieee_floatt::to_string_decimal(unsigned precision) const
226+
std::string ieee_floatt::to_string_decimal(std::size_t precision) const
227227
{
228228
std::string result;
229229

@@ -244,7 +244,7 @@ std::string ieee_floatt::to_string_decimal(unsigned precision) const
244244
if(precision>0)
245245
{
246246
result+='.';
247-
for(unsigned i=0; i<precision; i++)
247+
for(std::size_t i=0; i<precision; i++)
248248
result+='0';
249249
}
250250
}
@@ -262,7 +262,7 @@ std::string ieee_floatt::to_string_decimal(unsigned precision) const
262262
if(precision>0)
263263
{
264264
result+='.';
265-
for(unsigned i=0; i<precision; i++)
265+
for(std::size_t i=0; i<precision; i++)
266266
result+='0';
267267
}
268268
}
@@ -325,7 +325,7 @@ Function: ieee_floatt::to_string_scientific
325325
326326
\*******************************************************************/
327327

328-
std::string ieee_floatt::to_string_scientific(unsigned precision) const
328+
std::string ieee_floatt::to_string_scientific(std::size_t precision) const
329329
{
330330
std::string result;
331331

@@ -346,7 +346,7 @@ std::string ieee_floatt::to_string_scientific(unsigned precision) const
346346
if(precision>0)
347347
{
348348
result+='.';
349-
for(unsigned i=0; i<precision; i++)
349+
for(std::size_t i=0; i<precision; i++)
350350
result+='0';
351351
}
352352

@@ -747,7 +747,7 @@ void ieee_floatt::align()
747747
mp_integer f_power=power(2, spec.f);
748748
mp_integer f_power_next=power(2, spec.f+1);
749749

750-
unsigned lowPower2 = fraction.floorPow2();
750+
std::size_t lowPower2 = fraction.floorPow2();
751751
mp_integer exponent_offset=0;
752752

753753
if (lowPower2 < spec.f) // too small

src/util/ieee_float.h

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class floatbv_typet;
2020
class ieee_float_spect
2121
{
2222
public:
23-
// Bits for fraction (excluding hidden bit) and exponent,
24-
// respectively
25-
unsigned f, e;
23+
// Number of bits for fraction (excluding hidden bit)
24+
// and exponent, respectively
25+
std::size_t f, e;
2626

2727
// x86 has an extended precision format with an explicit
2828
// integer bit.
@@ -41,11 +41,11 @@ class ieee_float_spect
4141
{
4242
}
4343

44-
ieee_float_spect(unsigned _f, unsigned _e):f(_f), e(_e), x86_extended(false)
44+
ieee_float_spect(std::size_t _f, std::size_t _e):f(_f), e(_e), x86_extended(false)
4545
{
4646
}
4747

48-
inline unsigned width() const
48+
inline std::size_t width() const
4949
{
5050
// Add one for the sign bit.
5151
// Add one if x86 explicit integer bit is used.
@@ -241,8 +241,8 @@ class ieee_floatt
241241
return format(format_spect());
242242
}
243243

244-
std::string to_string_decimal(unsigned precision) const;
245-
std::string to_string_scientific(unsigned precision) const;
244+
std::string to_string_decimal(std::size_t precision) const;
245+
std::string to_string_scientific(std::size_t precision) const;
246246
std::string format(const format_spect &format_spec) const;
247247

248248
friend inline std::ostream& operator << (std::ostream &out, const ieee_floatt &f)

src/util/std_expr.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -218,7 +218,7 @@ Function: shift_exprt::shift_exprt
218218
shift_exprt::shift_exprt(
219219
const exprt &_src,
220220
const irep_idt &_id,
221-
const unsigned _distance):
221+
const std::size_t _distance):
222222
binary_exprt(_src, _id, constant_exprt::integer_constant(_distance))
223223
{
224224
}
@@ -237,7 +237,7 @@ Function: extractbit_exprt::extractbit_exprt
237237

238238
extractbit_exprt::extractbit_exprt(
239239
const exprt &_src,
240-
const unsigned _index):
240+
const std::size_t _index):
241241
binary_predicate_exprt(
242242
_src, ID_extractbit, constant_exprt::integer_constant(_index))
243243
{
@@ -257,8 +257,8 @@ Function: extractbit_exprt::extractbits_exprt
257257

258258
extractbits_exprt::extractbits_exprt(
259259
const exprt &_src,
260-
const unsigned _upper,
261-
const unsigned _lower,
260+
const std::size_t _upper,
261+
const std::size_t _lower,
262262
const typet &_type):
263263
exprt(ID_extractbits, _type)
264264
{

src/util/std_expr.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -2005,7 +2005,7 @@ class shift_exprt:public binary_exprt
20052005
{
20062006
}
20072007

2008-
shift_exprt(const exprt &_src, const irep_idt &_id, const unsigned _distance);
2008+
shift_exprt(const exprt &_src, const irep_idt &_id, const std::size_t _distance);
20092009

20102010
inline exprt &op()
20112011
{
@@ -2066,7 +2066,7 @@ class shl_exprt:public shift_exprt
20662066
{
20672067
}
20682068

2069-
shl_exprt(const exprt &_src, const unsigned _distance):shift_exprt(_src, ID_shl, _distance)
2069+
shl_exprt(const exprt &_src, const std::size_t _distance):shift_exprt(_src, ID_shl, _distance)
20702070
{
20712071
}
20722072
};
@@ -2084,7 +2084,7 @@ class ashr_exprt:public shift_exprt
20842084
{
20852085
}
20862086

2087-
inline ashr_exprt(const exprt &_src, const unsigned _distance):shift_exprt(_src, ID_ashr, _distance)
2087+
inline ashr_exprt(const exprt &_src, const std::size_t _distance):shift_exprt(_src, ID_ashr, _distance)
20882088
{
20892089
}
20902090
};
@@ -2102,7 +2102,7 @@ class lshr_exprt:public shift_exprt
21022102
{
21032103
}
21042104

2105-
inline lshr_exprt(const exprt &_src, const unsigned _distance):shift_exprt(_src, ID_lshr, _distance)
2105+
inline lshr_exprt(const exprt &_src, const std::size_t _distance):shift_exprt(_src, ID_lshr, _distance)
21062106
{
21072107
}
21082108
};
@@ -2190,7 +2190,7 @@ class extractbit_exprt:public binary_predicate_exprt
21902190

21912191
extractbit_exprt(
21922192
const exprt &_src,
2193-
const unsigned _index);
2193+
const std::size_t _index);
21942194

21952195
exprt &src()
21962196
{
@@ -2260,8 +2260,8 @@ class extractbits_exprt:public exprt
22602260

22612261
extractbits_exprt(
22622262
const exprt &_src,
2263-
const unsigned _upper,
2264-
const unsigned _lower,
2263+
const std::size_t _upper,
2264+
const std::size_t _lower,
22652265
const typet &_type);
22662266

22672267
exprt &src()
@@ -2936,7 +2936,7 @@ class member_exprt:public exprt
29362936
return get_size_t(ID_component_number);
29372937
}
29382938

2939-
inline void set_component_number(unsigned component_number)
2939+
inline void set_component_number(std::size_t component_number)
29402940
{
29412941
set(ID_component_number, component_number);
29422942
}

src/xmllang/graphml.cpp

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -31,12 +31,12 @@ Function: add_node
3131
3232
\*******************************************************************/
3333

34-
static unsigned add_node(
34+
static std::size_t add_node(
3535
const std::string &name,
36-
std::map<std::string, unsigned> &name_to_node,
36+
std::map<std::string, std::size_t> &name_to_node,
3737
graphmlt &graph)
3838
{
39-
std::pair<std::map<std::string, unsigned>::iterator, bool> entry=
39+
std::pair<std::map<std::string, std::size_t>::iterator, bool> entry=
4040
name_to_node.insert(std::make_pair(name, 0));
4141
if(entry.second)
4242
entry.first->second=graph.add_node();
@@ -58,7 +58,7 @@ Function: build_graph_rec
5858

5959
static bool build_graph_rec(
6060
const xmlt &xml,
61-
std::map<std::string, unsigned> &name_to_node,
61+
std::map<std::string, std::size_t> &name_to_node,
6262
std::map<std::string, std::map<std::string, std::string> > &defaults,
6363
graphmlt &dest,
6464
std::string &entrynode)
@@ -67,7 +67,7 @@ static bool build_graph_rec(
6767
{
6868
const std::string node_name=xml.get_attribute("id");
6969

70-
const unsigned n=add_node(node_name, name_to_node, dest);
70+
const std::size_t n=add_node(node_name, name_to_node, dest);
7171

7272
graphmlt::nodet &node=dest[n];
7373
node.node_name=node_name;
@@ -184,7 +184,7 @@ static bool build_graph(
184184
{
185185
assert(dest.size()==0);
186186

187-
std::map<std::string, unsigned> name_to_node;
187+
std::map<std::string, std::size_t> name_to_node;
188188
std::map<std::string, std::map<std::string, std::string> > defaults;
189189
std::string entrynode;
190190

@@ -196,15 +196,15 @@ static bool build_graph(
196196
dest,
197197
entrynode);
198198

199-
for(unsigned i=0; !err && i<dest.size(); ++i)
199+
for(std::size_t i=0; !err && i<dest.size(); ++i)
200200
{
201201
const graphmlt::nodet &n=dest[i];
202202

203203
assert(!n.node_name.empty());
204204
}
205205

206206
assert(!entrynode.empty());
207-
std::map<std::string, unsigned>::const_iterator it=
207+
std::map<std::string, std::size_t>::const_iterator it=
208208
name_to_node.find(entrynode);
209209
assert(it!=name_to_node.end());
210210
entry=it->second;

0 commit comments

Comments
 (0)