Skip to content

Commit 440ea26

Browse files
committed
Use bv_utilst::zeros
This makes code more concise and possibly more efficient.
1 parent 782c222 commit 440ea26

File tree

2 files changed

+4
-13
lines changed

2 files changed

+4
-13
lines changed

src/solvers/flattening/boolbv_div.cpp

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -37,8 +37,7 @@ bvt boolbvt::convert_div(const div_exprt &expr)
3737
std::size_t fraction_bits=
3838
to_fixedbv_type(expr.type()).get_fraction_bits();
3939

40-
bvt zeros;
41-
zeros.resize(fraction_bits, const_literal(false));
40+
bvt zeros = bv_utils.zeros(fraction_bits);
4241

4342
// add fraction_bits least-significant bits
4443
op0.insert(op0.begin(), zeros.begin(), zeros.end());

src/solvers/flattening/bv_utils.cpp

Lines changed: 3 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -715,13 +715,9 @@ bvt bv_utilst::unsigned_multiplier(const bvt &_op0, const bvt &_op1)
715715
for(std::size_t sum=0; sum<op0.size(); sum++)
716716
if(op0[sum]!=const_literal(false))
717717
{
718-
bvt tmpop;
719-
718+
bvt tmpop = zeros(sum);
720719
tmpop.reserve(op0.size());
721720

722-
for(std::size_t idx=0; idx<sum; idx++)
723-
tmpop.push_back(const_literal(false));
724-
725721
for(std::size_t idx=sum; idx<op0.size(); idx++)
726722
tmpop.push_back(prop.land(op1[idx-sum], op0[sum]));
727723

@@ -746,13 +742,9 @@ bvt bv_utilst::unsigned_multiplier(const bvt &_op0, const bvt &_op1)
746742
for(std::size_t bit=0; bit<op0.size(); bit++)
747743
if(op0[bit]!=const_literal(false))
748744
{
749-
bvt pp;
750-
751-
pp.reserve(op0.size());
752-
753745
// zeros according to weight
754-
for(std::size_t idx=0; idx<bit; idx++)
755-
pp.push_back(const_literal(false));
746+
bvt pp = zeros(bit);
747+
pp.reserve(op0.size());
756748
757749
for(std::size_t idx=bit; idx<op0.size(); idx++)
758750
pp.push_back(prop.land(op1[idx-bit], op0[bit]));

0 commit comments

Comments
 (0)