Skip to content

Commit 43b95ca

Browse files
thk123Daniel Kroening
thk123
authored and
Daniel Kroening
committed
Replaced loop with simpler expression
Previously we were piping a number of zeros inside a for loop. This can be simply done use the string constructor.
1 parent 0196734 commit 43b95ca

File tree

1 file changed

+5
-4
lines changed

1 file changed

+5
-4
lines changed

src/solvers/cvc/cvc_conv.cpp

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@ Author: Daniel Kroening, [email protected]
88

99
#include <cassert>
1010
#include <cctype>
11+
#include <string>
1112

1213
#include <util/arith_tools.h>
1314
#include <util/std_types.h>
@@ -114,8 +115,8 @@ void cvc_convt::convert_binary_expr(const exprt &expr, const exprt &op)
114115
{
115116
out << "(0bin";
116117

117-
for(unsigned i=from_width; i<to_width; i++)
118-
out << "0";
118+
if(to_width > from_width)
119+
out << std::string(to_width-from_width, '0');
119120

120121
out << " @ ";
121122

@@ -136,8 +137,8 @@ void cvc_convt::convert_binary_expr(const exprt &expr, const exprt &op)
136137
{
137138
out << "(0bin";
138139

139-
for(unsigned i=1; i<to_width; i++)
140-
out << "0";
140+
if(to_width > 1)
141+
out << std::string(to_width-1, '0');
141142

142143
out << " @ ";
143144

0 commit comments

Comments
 (0)