Configure Undefined Behaviour Sanitizer (#6290)

This commit is contained in:
Siarhei Fedartsou
2022-08-01 23:40:26 +02:00
committed by GitHub
parent 589becbfec
commit 00816722dd
11 changed files with 68 additions and 32 deletions
@@ -48,13 +48,14 @@ GetShortestRoundTrip(const NodeID new_loc,
const auto dist_from = dist_table(*from_node, new_loc);
const auto dist_to = dist_table(new_loc, *to_node);
const auto trip_dist = dist_from + dist_to - dist_table(*from_node, *to_node);
// If the edge_weight is very large (INVALID_EDGE_WEIGHT) then the algorithm will not choose
// this edge in final minimal path. So instead of computing all the permutations after this
// large edge, discard this edge right here and don't consider the path after this edge.
if (dist_from == INVALID_EDGE_WEIGHT || dist_to == INVALID_EDGE_WEIGHT)
continue;
const auto trip_dist = dist_from + dist_to - dist_table(*from_node, *to_node);
// This is not neccessarily true:
// Lets say you have an edge (u, v) with duration 100. If you place a coordinate exactly in
// the middle of the segment yielding (u, v'), the adjusted duration will be 100 * 0.5 = 50.