Skip to content

Commit 20f17ad

Browse files
authored
Merge pull request #3879 from tautschnig/deprecation-integer2unsigned
Use numeric_cast_v<unsigned> instead to_ulong with incompatible types [blocks: #3800]
2 parents 893d970 + 7d95e60 commit 20f17ad

File tree

3 files changed

+3
-8
lines changed

3 files changed

+3
-8
lines changed

src/goto-instrument/accelerate/acceleration_utils.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -1235,7 +1235,7 @@ void acceleration_utilst::extract_polynomial(
12351235
std::map<exprt, int> degrees;
12361236

12371237
mp_integer mp=binary2integer(concrete_term.get_value().c_str(), true);
1238-
monomial.coeff=mp.to_long();
1238+
monomial.coeff = numeric_cast_v<int>(mp);
12391239

12401240
if(monomial.coeff==0)
12411241
{

src/util/arith_tools.cpp

+1-1
Original file line numberDiff line numberDiff line change
@@ -231,7 +231,7 @@ mp_integer power(const mp_integer &base,
231231
case 2:
232232
{
233233
mp_integer result;
234-
result.setPower2(exponent.to_ulong());
234+
result.setPower2(numeric_cast_v<unsigned>(exponent));
235235
return result;
236236
}
237237
case 1: return 1;

src/util/ieee_float.cpp

+1-6
Original file line numberDiff line numberDiff line change
@@ -8,7 +8,6 @@ Author: Daniel Kroening, [email protected]
88

99
#include "ieee_float.h"
1010

11-
#include <cstdint>
1211
#include <ostream>
1312
#include <cmath>
1413
#include <limits>
@@ -1242,11 +1241,7 @@ float ieee_floatt::to_float() const
12421241
return std::numeric_limits<float>::quiet_NaN();
12431242
}
12441243

1245-
mp_integer i=pack();
1246-
CHECK_RETURN(i.is_ulong());
1247-
CHECK_RETURN(i <= std::numeric_limits<std::uint32_t>::max());
1248-
1249-
a.i=i.to_ulong();
1244+
a.i = numeric_cast_v<uint32_t>(pack());
12501245
return a.f;
12511246
}
12521247

0 commit comments

Comments
 (0)