Skip to content

Commit

Permalink
Fix bit-shift overflow in MLD partition step for Windows builds
Browse files Browse the repository at this point in the history
For very large graphs, generation of level masks fail on Windows
due to bit shift overflow of unsigned long values.

Correct by using unsigned long long literals, which are 64 bit on
all major systems.
  • Loading branch information
mjjbell committed Nov 7, 2020
1 parent 1ba8aba commit 79f7370
Show file tree
Hide file tree
Showing 2 changed files with 5 additions and 2 deletions.
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,9 @@
- Changes from 5.23.0
- Infrastructure
- CHANGED: Bundled protozero updated to v1.7.0. [#5858](https://github.com/Project-OSRM/osrm-backend/pull/5858)
- Windows:
- FIXED: Fix bit-shift overflow in MLD partition step. [#5878](https://github.com/Project-OSRM/osrm-backend/pull/5878)


# 5.23.0
- Changes from 5.22.0
Expand Down
4 changes: 2 additions & 2 deletions include/partitioner/multi_level_partition.hpp
Original file line number Diff line number Diff line change
Expand Up @@ -212,10 +212,10 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
// create mask that has `bits` ones at its LSBs.
// 000011
BOOST_ASSERT(offset < NUM_PARTITION_BITS);
PartitionID mask = (1UL << offset) - 1UL;
PartitionID mask = (1ULL << offset) - 1ULL;
// 001111
BOOST_ASSERT(next_offset < NUM_PARTITION_BITS);
PartitionID next_mask = (1UL << next_offset) - 1UL;
PartitionID next_mask = (1ULL << next_offset) - 1ULL;
// 001100
masks[lidx++] = next_mask ^ mask;
});
Expand Down

0 comments on commit 79f7370

Please sign in to comment.