Skip to content

Commit 0a063b3

Browse files
committed
Avoid unncessary signed/unsigned conversion
1 parent 8187bdd commit 0a063b3

File tree

1 file changed

+3
-7
lines changed

1 file changed

+3
-7
lines changed

src/goto-instrument/accelerate/polynomial.cpp

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -138,15 +138,11 @@ void polynomialt::from_expr(const exprt &expr)
138138
}
139139
else if(expr.id()==ID_constant)
140140
{
141-
mp_integer mp;
142-
unsigned int l;
143-
constant_exprt const_expr=to_constant_expr(expr);
144-
145-
mp=binary2integer(const_expr.get_value().c_str(), true);
146-
l=mp.to_long();
141+
const constant_exprt &const_expr = to_constant_expr(expr);
142+
const mp_integer mp = binary2integer(const_expr.get_value().c_str(), true);
147143

148144
monomialt monomial;
149-
monomial.coeff=l;
145+
monomial.coeff = numeric_cast_v<int>(mp);
150146

151147
monomials.push_back(monomial);
152148
}

0 commit comments

Comments
 (0)