Skip to content

Commit 699ca2b

Browse files
authored
Merge pull request #5758 from woltapp/gcc10
Fixes signed/unsigned comparision spotted by gcc10.
2 parents 8b40c59 + 919fe74 commit 699ca2b

File tree

1 file changed

+12
-7
lines changed

1 file changed

+12
-7
lines changed

include/engine/routing_algorithms/routing_base.hpp

Lines changed: 12 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -192,17 +192,22 @@ void annotatePath(const FacadeT &facade,
192192

193193
const bool is_first_segment = unpacked_path.empty();
194194

195-
const std::size_t start_index =
196-
(is_first_segment ? ((start_traversed_in_reverse)
197-
? weight_vector.size() -
198-
phantom_node_pair.source_phantom.fwd_segment_position - 1
199-
: phantom_node_pair.source_phantom.fwd_segment_position)
200-
: 0);
195+
std::size_t start_index = 0;
196+
if (is_first_segment)
197+
{
198+
unsigned short segment_position = phantom_node_pair.source_phantom.fwd_segment_position;
199+
if (start_traversed_in_reverse)
200+
{
201+
segment_position = weight_vector.size() -
202+
phantom_node_pair.source_phantom.fwd_segment_position - 1;
203+
}
204+
BOOST_ASSERT(segment_position >= 0);
205+
start_index = static_cast<std::size_t>(segment_position);
206+
}
201207
const std::size_t end_index = weight_vector.size();
202208

203209
bool is_left_hand_driving = facade.IsLeftHandDriving(node_id);
204210

205-
BOOST_ASSERT(start_index >= 0);
206211
BOOST_ASSERT(start_index < end_index);
207212
for (std::size_t segment_idx = start_index; segment_idx < end_index; ++segment_idx)
208213
{

0 commit comments

Comments
 (0)