Fix osrm-contract, tests, on Windows
As part of graph contraction, node renumbering leads to in-place permuting of graph state, including boolean vector elements. std::vector<bool> returns proxy objects when referencing individual bits. To correctly swap bool elements using MSVC, we need to explicitly apply std::vector<bool>::swap. Making this change fixes osrm-contract on Windows. We also correct failing tests and other undefined behaviours (mainly iterator access outside boundaries) highlighted by MSVC.
This commit is contained in:
@@ -164,11 +164,11 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
|
||||
// of cell ids efficiently.
|
||||
inline NodeID GetSentinelNode() const { return partition.size() - 1; }
|
||||
|
||||
void SetCellID(LevelID l, NodeID node, std::size_t cell_id)
|
||||
void SetCellID(LevelID l, NodeID node, CellID cell_id)
|
||||
{
|
||||
auto lidx = LevelIDToIndex(l);
|
||||
|
||||
auto shifted_id = cell_id << level_data->lidx_to_offset[lidx];
|
||||
auto shifted_id = static_cast<std::uint64_t>(cell_id) << level_data->lidx_to_offset[lidx];
|
||||
auto cleared_cell = partition[node] & ~level_data->lidx_to_mask[lidx];
|
||||
partition[node] = cleared_cell | shifted_id;
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user