Skip to content

Commit 42cc4b6

Browse files
author
kroening
committed
cleanup
git-svn-id: svn+ssh://svn.cprover.org/srv/svn/cbmc/trunk@1055 6afb6bc1-c8e4-404c-8f48-9ae832c5b171
1 parent aca30f7 commit 42cc4b6

File tree

3 files changed

+15
-14
lines changed

3 files changed

+15
-14
lines changed

src/solvers/flattening/boolbv.cpp

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -490,7 +490,8 @@ Function: boolbvt::convert_symbol
490490

491491
void boolbvt::convert_symbol(const exprt &expr, bvt &bv)
492492
{
493-
unsigned width=boolbv_width(expr.type());
493+
const typet &type=expr.type();
494+
unsigned width=boolbv_width(type);
494495

495496
bv.resize(width);
496497

@@ -502,7 +503,7 @@ void boolbvt::convert_symbol(const exprt &expr, bvt &bv)
502503
if(width==0)
503504
{
504505
// just put in map
505-
map.get_map_entry(identifier, expr.type());
506+
map.get_map_entry(identifier, type);
506507
}
507508
else
508509
{

src/solvers/flattening/boolbv_map.cpp

Lines changed: 10 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -90,14 +90,15 @@ literalt boolbv_mapt::get_literal(
9090
map_entryt &map_entry=get_map_entry(identifier, type);
9191

9292
assert(bit<map_entry.literal_map.size());
93+
map_bitt &mb=map_entry.literal_map[bit];
9394

94-
if(map_entry.literal_map[bit].is_set)
95-
return map_entry.literal_map[bit].l;
95+
if(mb.is_set)
96+
return mb.l;
9697

9798
literalt l=prop.new_variable();
9899

99-
map_entry.literal_map[bit].is_set=true;
100-
map_entry.literal_map[bit].l=l;
100+
mb.is_set=true;
101+
mb.l=l;
101102

102103
#ifdef DEBUG
103104
std::cout << "NEW: " << identifier << ":" << bit
@@ -130,14 +131,15 @@ void boolbv_mapt::set_literal(
130131

131132
map_entryt &map_entry=get_map_entry(identifier, type);
132133
assert(bit<map_entry.literal_map.size());
134+
map_bitt &mb=map_entry.literal_map[bit];
133135

134-
if(map_entry.literal_map[bit].is_set)
136+
if(mb.is_set)
135137
{
136-
prop.set_equal(map_entry.literal_map[bit].l, literal);
138+
prop.set_equal(mb.l, literal);
137139
return;
138140
}
139141

140-
map_entry.literal_map[bit].is_set=true;
141-
map_entry.literal_map[bit].l=literal;
142+
mb.is_set=true;
143+
mb.l=literal;
142144
}
143145

src/solvers/flattening/bv_utils.cpp

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -680,10 +680,8 @@ literalt bv_utilst::overflow_negate(const bvt &bv)
680680
// a overflow on unary- can only happen with the smallest
681681
// representable number 100....0
682682

683-
bvt zeros;
684-
685-
for(unsigned i=0; i<bv.size()-1; i++)
686-
zeros.push_back(bv[i]);
683+
bvt zeros(bv);
684+
zeros.erase(--zeros.end());
687685

688686
return prop.land(bv[bv.size()-1], prop.lnot(prop.lor(zeros)));
689687
}

0 commit comments

Comments
 (0)