Skip to content

Commit

Permalink
ignore bugprone-branch-clone lint warning
Browse files Browse the repository at this point in the history
  • Loading branch information
EliasLF committed Jan 15, 2024
1 parent 2d1e361 commit c940d49
Showing 1 changed file with 8 additions and 0 deletions.
8 changes: 8 additions & 0 deletions src/heuristic/HeuristicMapper.cpp
Original file line number Diff line number Diff line change
Expand Up @@ -865,6 +865,9 @@ void HeuristicMapper::recalculateFixedCostNonFidelity(Node& node) {
// swap costs
for (auto& swap : node.swaps) {
if (swap.op == qc::SWAP) {
// branch clone intended for performance reasons (checking edge-wise for
// bidirectionality is not O(1))
// NOLINTBEGIN(bugprone-branch-clone)
if (architecture->bidirectional()) {
node.costFixed += COST_BIDIRECTIONAL_SWAP;
} else if (architecture->unidirectional() ||
Expand All @@ -874,6 +877,7 @@ void HeuristicMapper::recalculateFixedCostNonFidelity(Node& node) {
} else {
node.costFixed += COST_BIDIRECTIONAL_SWAP;
}
// NOLINTEND(bugprone-branch-clone)
} else if (swap.op == qc::Teleportation) {
node.costFixed += COST_TELEPORTATION;
}
Expand Down Expand Up @@ -1019,6 +1023,9 @@ void HeuristicMapper::applySWAP(const Edge& swap, std::size_t layer,
node.costFixed +=
architecture->getSwapFidelityCost(swap.first, swap.second);
} else {
// branch clone intended for performance reasons (checking edge-wise for
// bidirectionality is not O(1))
// NOLINTBEGIN(bugprone-branch-clone)
if (architecture->bidirectional()) {
node.costFixed += COST_BIDIRECTIONAL_SWAP;
} else if (architecture->unidirectional() ||
Expand All @@ -1027,6 +1034,7 @@ void HeuristicMapper::applySWAP(const Edge& swap, std::size_t layer,
} else {
node.costFixed += COST_BIDIRECTIONAL_SWAP;
}
// NOLINTEND(bugprone-branch-clone)
}

recalculateFixedCostReversals(layer, node);
Expand Down

0 comments on commit c940d49

Please sign in to comment.