Skip to content

Commit b71219e

Browse files
committed
🚨 fix a couple of gcc compiler warnings
Signed-off-by: burgholzer <[email protected]>
1 parent 7bd1878 commit b71219e

File tree

2 files changed

+10
-22
lines changed

2 files changed

+10
-22
lines changed

src/logicblocks/LogicTerm.cpp

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -334,7 +334,7 @@ int LogicTerm::getIntValue() const {
334334
case CType::BITVECTOR:
335335
return static_cast<int>(bvValue);
336336
default:
337-
return std::numeric_limits<int>::infinity();
337+
return std::numeric_limits<int>::max();
338338
}
339339
}
340340

@@ -349,7 +349,7 @@ double LogicTerm::getFloatValue() const {
349349
case CType::BITVECTOR:
350350
return static_cast<double>(bvValue);
351351
default:
352-
return std::numeric_limits<double>::infinity();
352+
return std::numeric_limits<double>::max();
353353
}
354354
}
355355

@@ -364,7 +364,7 @@ uint64_t LogicTerm::getBitVectorValue() const {
364364
case CType::BITVECTOR:
365365
return bvValue & (static_cast<uint64_t>(std::pow(2, bvSize)) - 1U);
366366
default:
367-
return std::numeric_limits<uint64_t>::infinity();
367+
return std::numeric_limits<uint64_t>::max();
368368
}
369369
}
370370

@@ -379,7 +379,7 @@ uint16_t LogicTerm::getBitVectorSize() const {
379379
case CType::BITVECTOR:
380380
return bvSize;
381381
default:
382-
return std::numeric_limits<uint16_t>::infinity();
382+
return std::numeric_limits<uint16_t>::max();
383383
}
384384
}
385385

test/sc/heuristic/test_heuristic.cpp

Lines changed: 6 additions & 18 deletions
Original file line numberDiff line numberDiff line change
@@ -1299,33 +1299,21 @@ TEST(Functionality, DataLogger) {
12991299
const auto& singleQubitFidelityCosts =
13001300
architecture.getSingleQubitFidelityCosts();
13011301
for (std::size_t i = 0; i < singleQubitFidelityCosts.size(); ++i) {
1302-
if (std::isinf(singleQubitFidelityCosts[i])) {
1303-
EXPECT_TRUE(fidelityJson["single_qubit_fidelity_costs"][i].is_null());
1304-
} else {
1305-
EXPECT_EQ(fidelityJson["single_qubit_fidelity_costs"][i],
1306-
singleQubitFidelityCosts[i]);
1307-
}
1302+
EXPECT_EQ(fidelityJson["single_qubit_fidelity_costs"][i],
1303+
singleQubitFidelityCosts[i]);
13081304
}
13091305
const auto& twoQubitFidelityCosts = architecture.getTwoQubitFidelityCosts();
13101306
for (std::size_t i = 0; i < twoQubitFidelityCosts.size(); ++i) {
13111307
for (std::size_t j = 0; j < twoQubitFidelityCosts[i].size(); ++j) {
1312-
if (std::isinf(twoQubitFidelityCosts[i][j])) {
1313-
EXPECT_TRUE(fidelityJson["two_qubit_fidelity_costs"][i][j].is_null());
1314-
} else {
1315-
EXPECT_EQ(fidelityJson["two_qubit_fidelity_costs"][i][j],
1316-
twoQubitFidelityCosts[i][j]);
1317-
}
1308+
EXPECT_EQ(fidelityJson["two_qubit_fidelity_costs"][i][j],
1309+
twoQubitFidelityCosts[i][j]);
13181310
}
13191311
}
13201312
const auto& swapFidelityCosts = architecture.getSwapFidelityCosts();
13211313
for (std::size_t i = 0; i < swapFidelityCosts.size(); ++i) {
13221314
for (std::size_t j = 0; j < swapFidelityCosts[i].size(); ++j) {
1323-
if (std::isinf(swapFidelityCosts[i][j])) {
1324-
EXPECT_TRUE(fidelityJson["swap_fidelity_costs"][i][j].is_null());
1325-
} else {
1326-
EXPECT_EQ(fidelityJson["swap_fidelity_costs"][i][j],
1327-
swapFidelityCosts[i][j]);
1328-
}
1315+
EXPECT_EQ(fidelityJson["swap_fidelity_costs"][i][j],
1316+
swapFidelityCosts[i][j]);
13291317
}
13301318
}
13311319

0 commit comments

Comments
 (0)