Skip to content

Commit 1a8a92e

Browse files
committed
use std::size_t
1 parent 453227a commit 1a8a92e

File tree

9 files changed

+75
-81
lines changed

9 files changed

+75
-81
lines changed

src/goto-programs/cfg.h

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ template<class T,
4242
class cfg_baset:public graph< cfg_base_nodet<T,I> >
4343
{
4444
public:
45-
typedef unsigned entryt;
45+
typedef std::size_t entryt;
4646

4747
struct entry_mapt:
4848
public std::map<goto_programt::const_targett, entryt>

src/solvers/flattening/pointer_logic.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,10 +52,10 @@ Function: pointer_logict::get_dynamic_objects
5252
5353
\*******************************************************************/
5454

55-
void pointer_logict::get_dynamic_objects(std::vector<unsigned> &o) const
55+
void pointer_logict::get_dynamic_objects(std::vector<std::size_t> &o) const
5656
{
5757
o.clear();
58-
unsigned nr=0;
58+
std::size_t nr=0;
5959

6060
for(pointer_logict::objectst::const_iterator
6161
it=objects.begin();
@@ -77,7 +77,7 @@ Function: pointer_logict::add_object
7777
7878
\*******************************************************************/
7979

80-
unsigned pointer_logict::add_object(const exprt &expr)
80+
std::size_t pointer_logict::add_object(const exprt &expr)
8181
{
8282
// remove any index/member
8383

@@ -108,7 +108,7 @@ Function: pointer_logict::pointer_expr
108108
\*******************************************************************/
109109

110110
exprt pointer_logict::pointer_expr(
111-
unsigned object,
111+
std::size_t object,
112112
const typet &type) const
113113
{
114114
pointert pointer(object, 0);

src/solvers/flattening/pointer_logic.h

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -25,14 +25,14 @@ class pointer_logict
2525

2626
struct pointert
2727
{
28-
unsigned object;
28+
std::size_t object;
2929
mp_integer offset;
3030

3131
pointert()
3232
{
3333
}
3434

35-
pointert(unsigned _obj, mp_integer _off):object(_obj), offset(_off)
35+
pointert(std::size_t _obj, mp_integer _off):object(_obj), offset(_off)
3636
{
3737
}
3838
};
@@ -44,33 +44,33 @@ class pointer_logict
4444

4545
// converts an (object,0) pair to an expression
4646
exprt pointer_expr(
47-
unsigned object,
47+
std::size_t object,
4848
const typet &type) const;
4949

5050
~pointer_logict();
5151
explicit pointer_logict(const namespacet &_ns);
5252

53-
unsigned add_object(const exprt &expr);
53+
std::size_t add_object(const exprt &expr);
5454

5555
// number of NULL object
56-
unsigned get_null_object() const
56+
std::size_t get_null_object() const
5757
{
5858
return null_object;
5959
}
6060

6161
// number of INVALID object
62-
unsigned get_invalid_object() const
62+
std::size_t get_invalid_object() const
6363
{
6464
return invalid_object;
6565
}
6666

6767
bool is_dynamic_object(const exprt &expr) const;
6868

69-
void get_dynamic_objects(std::vector<unsigned> &objects) const;
69+
void get_dynamic_objects(std::vector<std::size_t> &objects) const;
7070

7171
protected:
7272
const namespacet &ns;
73-
unsigned null_object, invalid_object;
73+
std::size_t null_object, invalid_object;
7474

7575
exprt pointer_expr(
7676
const mp_integer &offset,

src/solvers/floatbv/float_bv.cpp

Lines changed: 30 additions & 30 deletions
Original file line numberDiff line numberDiff line change
@@ -216,7 +216,7 @@ exprt float_bvt::is_zero(
216216
{
217217
// we mask away the sign bit, which is the most significand bit
218218
const floatbv_typet &type=to_floatbv_type(src.type());
219-
unsigned width=type.get_width();
219+
std::size_t width=type.get_width();
220220

221221
std::string mask_str;
222222
mask_str.resize(width, '1');
@@ -333,7 +333,7 @@ Function: float_bvt::sign_bit
333333
exprt float_bvt::sign_bit(const exprt &op)
334334
{
335335
const bitvector_typet &bv_type=to_bitvector_type(op.type());
336-
unsigned width=bv_type.get_width();
336+
std::size_t width=bv_type.get_width();
337337
return extractbit_exprt(op, width-1);
338338
}
339339

@@ -354,7 +354,7 @@ exprt float_bvt::from_signed_integer(
354354
const exprt &rm,
355355
const ieee_float_spect &spec)
356356
{
357-
unsigned src_width=to_signedbv_type(src.type()).get_width();
357+
std::size_t src_width=to_signedbv_type(src.type()).get_width();
358358

359359
unbiased_floatt result;
360360

@@ -394,7 +394,7 @@ exprt float_bvt::from_unsigned_integer(
394394

395395
result.fraction=src;
396396

397-
unsigned src_width=to_unsignedbv_type(src.type()).get_width();
397+
std::size_t src_width=to_unsignedbv_type(src.type()).get_width();
398398

399399
// build an exponent (unbiased) -- this is signed!
400400
result.exponent=
@@ -421,7 +421,7 @@ Function: float_bvt::to_signed_integer
421421

422422
exprt float_bvt::to_signed_integer(
423423
const exprt &src,
424-
unsigned dest_width,
424+
std::size_t dest_width,
425425
const exprt &rm,
426426
const ieee_float_spect &spec)
427427
{
@@ -442,7 +442,7 @@ Function: float_bvt::to_unsigned_integer
442442

443443
exprt float_bvt::to_unsigned_integer(
444444
const exprt &src,
445-
unsigned dest_width,
445+
std::size_t dest_width,
446446
const exprt &rm,
447447
const ieee_float_spect &spec)
448448
{
@@ -463,7 +463,7 @@ Function: float_bvt::to_integer
463463

464464
exprt float_bvt::to_integer(
465465
const exprt &src,
466-
unsigned dest_width,
466+
std::size_t dest_width,
467467
bool is_signed,
468468
const exprt &rm,
469469
const ieee_float_spect &spec)
@@ -553,7 +553,7 @@ exprt float_bvt::conversion(
553553
unbiased_floatt result;
554554

555555
// the fraction gets zero-padded
556-
unsigned padding=dest_spec.f-src_spec.f;
556+
std::size_t padding=dest_spec.f-src_spec.f;
557557
result.fraction=
558558
concatenation_exprt(
559559
unpacked_src.fraction,
@@ -624,8 +624,8 @@ exprt float_bvt::subtract_exponents(
624624
const unbiased_floatt &src2)
625625
{
626626
// extend both by one bit
627-
unsigned old_width1=to_signedbv_type(src1.exponent.type()).get_width();
628-
unsigned old_width2=to_signedbv_type(src2.exponent.type()).get_width();
627+
std::size_t old_width1=to_signedbv_type(src1.exponent.type()).get_width();
628+
std::size_t old_width2=to_signedbv_type(src2.exponent.type()).get_width();
629629
assert(old_width1==old_width2);
630630

631631
exprt extended_exponent1=typecast_exprt(src1.exponent, signedbv_typet(old_width1+1));
@@ -720,7 +720,7 @@ exprt float_bvt::add_sub(
720720
plus_exprt(fraction1_ext, fraction2_ext));
721721

722722
// sign of result
723-
unsigned width = to_bitvector_type(result.fraction.type()).get_width();
723+
std::size_t width = to_bitvector_type(result.fraction.type()).get_width();
724724
exprt fraction_sign=sign_exprt(typecast_exprt(result.fraction, signedbv_typet(width)));
725725
result.fraction=typecast_exprt(abs_exprt(typecast_exprt(result.fraction, signedbv_typet(width))),
726726
unsignedbv_typet(width));
@@ -802,8 +802,8 @@ exprt float_bvt::limit_distance(
802802
const exprt &dist,
803803
mp_integer limit)
804804
{
805-
unsigned nb_bits=integer2unsigned(address_bits(limit));
806-
unsigned dist_width=to_unsignedbv_type(dist.type()).get_width();
805+
std::size_t nb_bits=integer2unsigned(address_bits(limit));
806+
std::size_t dist_width=to_unsignedbv_type(dist.type()).get_width();
807807

808808
if(dist_width<=nb_bits)
809809
return dist;
@@ -911,9 +911,9 @@ exprt float_bvt::div(
911911
const unbiased_floatt unpacked1=unpack(src1, spec);
912912
const unbiased_floatt unpacked2=unpack(src2, spec);
913913

914-
unsigned fraction_width=
914+
std::size_t fraction_width=
915915
to_unsignedbv_type(unpacked1.fraction.type()).get_width();
916-
unsigned div_width=fraction_width*2+1;
916+
std::size_t div_width=fraction_width*2+1;
917917

918918
// pad fraction1 with zeros
919919
exprt fraction1=
@@ -1212,8 +1212,8 @@ void float_bvt::normalization_shift(
12121212
// n-log-n alignment shifter.
12131213
// The worst-case shift is the number of fraction
12141214
// bits minus one, in case the faction is one exactly.
1215-
unsigned fraction_bits=to_unsignedbv_type(fraction.type()).get_width();
1216-
unsigned exponent_bits=to_signedbv_type(exponent.type()).get_width();
1215+
std::size_t fraction_bits=to_unsignedbv_type(fraction.type()).get_width();
1216+
std::size_t exponent_bits=to_signedbv_type(exponent.type()).get_width();
12171217
assert(fraction_bits!=0);
12181218

12191219
unsigned depth=integer2unsigned(address_bits(fraction_bits-1));
@@ -1280,7 +1280,7 @@ void float_bvt::denormalization_shift(
12801280
// i.e. the exponent of the smallest normal number and thus the 'base'
12811281
// exponent for subnormal numbers.
12821282

1283-
unsigned exponent_bits=to_signedbv_type(exponent.type()).get_width();
1283+
std::size_t exponent_bits=to_signedbv_type(exponent.type()).get_width();
12841284
assert(exponent_bits>=spec.e);
12851285

12861286
#if 1
@@ -1303,7 +1303,7 @@ void float_bvt::denormalization_shift(
13031303
#if 1
13041304
// Care must be taken to not loose information required for the
13051305
// guard and sticky bits. +3 is for the hidden, guard and sticky bits.
1306-
unsigned fraction_bits=to_unsignedbv_type(fraction.type()).get_width();
1306+
std::size_t fraction_bits=to_unsignedbv_type(fraction.type()).get_width();
13071307

13081308
if(fraction_bits < spec.f+3)
13091309
{
@@ -1413,18 +1413,18 @@ Function: float_bvt::fraction_rounding_decision
14131413
\*******************************************************************/
14141414

14151415
exprt float_bvt::fraction_rounding_decision(
1416-
const unsigned dest_bits,
1416+
const std::size_t dest_bits,
14171417
const exprt sign,
14181418
const exprt &fraction,
14191419
const rounding_mode_bitst &rounding_mode_bits)
14201420
{
1421-
unsigned fraction_bits=
1421+
std::size_t fraction_bits=
14221422
to_unsignedbv_type(fraction.type()).get_width();
14231423

14241424
assert(dest_bits<fraction_bits);
14251425

14261426
// we have too many fraction bits
1427-
unsigned extra_bits=fraction_bits-dest_bits;
1427+
std::size_t extra_bits=fraction_bits-dest_bits;
14281428

14291429
// more than two extra bits are superflus, and are
14301430
// turned into a sticky bit
@@ -1492,15 +1492,15 @@ void float_bvt::round_fraction(
14921492
const rounding_mode_bitst &rounding_mode_bits,
14931493
const ieee_float_spect &spec)
14941494
{
1495-
unsigned fraction_size=spec.f+1;
1496-
unsigned result_fraction_size=
1495+
std::size_t fraction_size=spec.f+1;
1496+
std::size_t result_fraction_size=
14971497
to_unsignedbv_type(result.fraction.type()).get_width();
14981498

14991499
// do we need to enlarge the fraction?
15001500
if(result_fraction_size<fraction_size)
15011501
{
15021502
// pad with zeros at bottom
1503-
unsigned padding=fraction_size-result_fraction_size;
1503+
std::size_t padding=fraction_size-result_fraction_size;
15041504

15051505
result.fraction=concatenation_exprt(
15061506
result.fraction,
@@ -1513,7 +1513,7 @@ void float_bvt::round_fraction(
15131513
}
15141514
else // fraction gets smaller -- rounding
15151515
{
1516-
unsigned extra_bits=result_fraction_size-fraction_size;
1516+
std::size_t extra_bits=result_fraction_size-fraction_size;
15171517
assert(extra_bits>=1);
15181518

15191519
// this computes the rounding decision
@@ -1612,7 +1612,7 @@ void float_bvt::round_exponent(
16121612
const rounding_mode_bitst &rounding_mode_bits,
16131613
const ieee_float_spect &spec)
16141614
{
1615-
unsigned result_exponent_size=
1615+
std::size_t result_exponent_size=
16161616
to_signedbv_type(result.exponent.type()).get_width();
16171617

16181618
// do we need to enlarge the exponent?
@@ -1877,13 +1877,13 @@ exprt float_bvt::sticky_right_shift(
18771877
const exprt &dist,
18781878
exprt &sticky)
18791879
{
1880-
unsigned d=1, width=to_unsignedbv_type(op.type()).get_width();
1880+
std::size_t d=1, width=to_unsignedbv_type(op.type()).get_width();
18811881
exprt result=op;
18821882
sticky=false_exprt();
18831883

1884-
unsigned dist_width=to_bitvector_type(dist.type()).get_width();
1884+
std::size_t dist_width=to_bitvector_type(dist.type()).get_width();
18851885

1886-
for(unsigned stage=0; stage<dist_width; stage++)
1886+
for(std::size_t stage=0; stage<dist_width; stage++)
18871887
{
18881888
exprt tmp=lshr_exprt(result, d);
18891889

src/solvers/floatbv/float_bv.h

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -52,9 +52,9 @@ class float_bvt
5252
// conversion
5353
exprt from_unsigned_integer(const exprt &, const exprt &rm, const ieee_float_spect &);
5454
exprt from_signed_integer(const exprt &, const exprt &rm, const ieee_float_spect &);
55-
exprt to_signed_integer(const exprt &src, unsigned dest_width, const exprt &rm, const ieee_float_spect &);
56-
exprt to_unsigned_integer(const exprt &src, unsigned dest_width, const exprt &rm, const ieee_float_spect &);
57-
exprt to_integer(const exprt &src, unsigned dest_width, bool is_signed, const exprt &rm, const ieee_float_spect &);
55+
exprt to_signed_integer(const exprt &src, std::size_t dest_width, const exprt &rm, const ieee_float_spect &);
56+
exprt to_unsigned_integer(const exprt &src, std::size_t dest_width, const exprt &rm, const ieee_float_spect &);
57+
exprt to_integer(const exprt &src, std::size_t dest_width, bool is_signed, const exprt &rm, const ieee_float_spect &);
5858
exprt conversion(const exprt &src, const exprt &rm, const ieee_float_spect &src_spec, const ieee_float_spect &dest_spec);
5959

6060
// relations
@@ -132,7 +132,7 @@ class float_bvt
132132

133133
// rounding decision for fraction
134134
exprt fraction_rounding_decision(
135-
const unsigned dest_bits,
135+
const std::size_t dest_bits,
136136
const exprt sign,
137137
const exprt &fraction,
138138
const rounding_mode_bitst &);

src/solvers/floatbv/float_utils.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -605,7 +605,7 @@ bvt float_utilst::div(const bvt &src1, const bvt &src2)
605605
const unbiased_floatt unpacked1=unpack(src1);
606606
const unbiased_floatt unpacked2=unpack(src2);
607607

608-
unsigned div_width=unpacked1.fraction.size()*2+1;
608+
std::size_t div_width=unpacked1.fraction.size()*2+1;
609609

610610
// pad fraction1 with zeros
611611
bvt fraction1=unpacked1.fraction;
@@ -1294,7 +1294,7 @@ literalt float_utilst::fraction_rounding_decision(
12941294
assert(dest_bits<fraction.size());
12951295

12961296
// we have too many fraction bits
1297-
unsigned extra_bits=fraction.size()-dest_bits;
1297+
std::size_t extra_bits=fraction.size()-dest_bits;
12981298

12991299
// more than two extra bits are superflus, and are
13001300
// turned into a sticky bit
@@ -1363,7 +1363,7 @@ void float_utilst::round_fraction(unbiased_floatt &result)
13631363
if(result.fraction.size()<fraction_size)
13641364
{
13651365
// pad with zeros at bottom
1366-
unsigned padding=fraction_size-result.fraction.size();
1366+
std::size_t padding=fraction_size-result.fraction.size();
13671367

13681368
result.fraction=bv_utils.concatenate(
13691369
bv_utils.zeros(padding),
@@ -1377,7 +1377,7 @@ void float_utilst::round_fraction(unbiased_floatt &result)
13771377
}
13781378
else // fraction gets smaller -- rounding
13791379
{
1380-
unsigned extra_bits=result.fraction.size()-fraction_size;
1380+
std::size_t extra_bits=result.fraction.size()-fraction_size;
13811381
assert(extra_bits>=1);
13821382

13831383
// this computes the rounding decision

0 commit comments

Comments
 (0)