1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70
|
From: Bastian Germann <bage@debian.org>
Date: Fri, 1 Nov 2024 16:26:50 +0100
Subject: Avoid compiler confusion on overloaded abs
---
diff --git a/src/multipath_alignment_graph.cpp b/src/multipath_alignment_graph.cpp
index 0d0a249..aeb1327 100644
--- a/src/multipath_alignment_graph.cpp
+++ b/src/multipath_alignment_graph.cpp
@@ -6417,7 +6417,7 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
for (const auto& path_node : path_nodes) {
for (const auto& edge : path_node.edges) {
const auto& next_node = path_nodes[edge.first];
- shift = max<size_t>(shift, abs<int64_t>((next_node.begin - path_node.end) - edge.second));
+ shift = max<size_t>(shift, llabs((next_node.begin - path_node.end) - edge.second));
}
}
return shift;
@@ -6441,7 +6441,7 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
++in_degree[edge.first];
const auto& next_node = path_nodes[edge.first];
- size_t shift = abs<int64_t>((next_node.begin - path_node.end) - edge.second);
+ size_t shift = llabs((next_node.begin - path_node.end) - edge.second);
#ifdef debug_shift_pruning
cerr << "shift DP reverse " << i << " <- " << edge.first << " with shift " << shift << " for total " << min_shift_rev[edge.first] + shift << endl;
@@ -6467,7 +6467,7 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
else {
for (auto& edge : path_node.edges) {
const auto& next_node = path_nodes[edge.first];
- size_t shift = abs<int64_t>((next_node.begin - path_node.end) - edge.second);
+ size_t shift = llabs((next_node.begin - path_node.end) - edge.second);
#ifdef debug_shift_pruning
cerr << "shift DP forward " << i << " -> " << edge.first << " with shift " << shift << " for total " << min_shift_fwd[i] + shift << endl;
#endif
@@ -6489,7 +6489,7 @@ void MultipathAlignmentGraph::align(const Alignment& alignment, const HandleGrap
for (size_t j = 0; j < path_node.edges.size(); ++j) {
auto& edge = path_node.edges[j];
const auto& next_node = path_nodes[edge.first];
- size_t shift = abs<int64_t>((next_node.begin - path_node.end) - edge.second);
+ size_t shift = llabs((next_node.begin - path_node.end) - edge.second);
size_t min_edge_shift = min_shift_fwd[i] + shift + min_shift_rev[edge.first];
diff --git a/src/multipath_mapper.cpp b/src/multipath_mapper.cpp
index 23e52a7..7f8c07f 100644
--- a/src/multipath_mapper.cpp
+++ b/src/multipath_mapper.cpp
@@ -2446,7 +2446,7 @@ namespace vg {
// in the left_idxs and right_idxs vectors
int64_t target_len = 2 * seq_len - left_side.clip_length - right_side.clip_length;
auto distance_diff = [&](size_t l, size_t r) {
- return abs<int64_t>(get<2>(left_sites[left_idxs[l]]) + get<2>(right_sites[right_idxs[r]]) - target_len);
+ return llabs(get<2>(left_sites[left_idxs[l]]) + get<2>(right_sites[right_idxs[r]]) - target_len);
};
// sweep to identify pairs that most nearly align
diff --git a/src/subcommand/gampcompare_main.cpp b/src/subcommand/gampcompare_main.cpp
index fd8b5b4..a6d5c4c 100644
--- a/src/subcommand/gampcompare_main.cpp
+++ b/src/subcommand/gampcompare_main.cpp
@@ -218,7 +218,7 @@ int main_gampcompare(int argc, char** argv) {
if (path_true_positions[i].second == path_mapped_positions[j].second) {
// there is a pair of positions on the same strand of the same path
abs_dist = min<int64_t>(abs_dist,
- abs<int64_t>(path_true_positions[i].first - path_mapped_positions[j].first));
+ llabs(path_true_positions[i].first - path_mapped_positions[j].first));
}
}
}
|