Skip to content

Commit b840c0b

Browse files
committed
Fix bit-shift overflow in MLD partition step for Windows builds
For very large graphs, generation of MLD 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.
1 parent 1ba8aba commit b840c0b

File tree

2 files changed

+5
-2
lines changed

2 files changed

+5
-2
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,9 @@
22
- Changes from 5.23.0
33
- Infrastructure
44
- CHANGED: Bundled protozero updated to v1.7.0. [#5858](https://github.com/Project-OSRM/osrm-backend/pull/5858)
5+
- Windows:
6+
- FIXED: Fix bit-shift overflow in MLD partition step. [#5878](https://github.com/Project-OSRM/osrm-backend/pull/5878)
7+
58

69
# 5.23.0
710
- Changes from 5.22.0

include/partitioner/multi_level_partition.hpp

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -212,10 +212,10 @@ template <storage::Ownership Ownership> class MultiLevelPartitionImpl final
212212
// create mask that has `bits` ones at its LSBs.
213213
// 000011
214214
BOOST_ASSERT(offset < NUM_PARTITION_BITS);
215-
PartitionID mask = (1UL << offset) - 1UL;
215+
PartitionID mask = (1ULL << offset) - 1ULL;
216216
// 001111
217217
BOOST_ASSERT(next_offset < NUM_PARTITION_BITS);
218-
PartitionID next_mask = (1UL << next_offset) - 1UL;
218+
PartitionID next_mask = (1ULL << next_offset) - 1ULL;
219219
// 001100
220220
masks[lidx++] = next_mask ^ mask;
221221
});

0 commit comments

Comments
 (0)