Skip to content

Commit c0c391a

Browse files
authored
Merge pull request #1491 from joto/zigzag-way-nodes
Use zigzag encoding for way node lists
2 parents 777b7ff + 1709c61 commit c0c391a

File tree

1 file changed

+4
-2
lines changed

1 file changed

+4
-2
lines changed

src/middle-ram.cpp

Lines changed: 4 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -142,7 +142,8 @@ static void add_delta_encoded_way_node_list(std::string *data,
142142
// Add delta encoded node ids
143143
osmium::DeltaEncode<osmid_t> delta;
144144
for (auto const &nr : wnl) {
145-
protozero::add_varint_to_buffer(data, delta.update(nr.ref()));
145+
protozero::add_varint_to_buffer(
146+
data, protozero::encode_zigzag64(delta.update(nr.ref())));
146147
}
147148
}
148149

@@ -226,7 +227,8 @@ get_delta_encoded_way_nodes_list(std::string const &data, std::size_t offset,
226227
osmium::DeltaDecode<osmid_t> delta;
227228
osmium::builder::WayNodeListBuilder wnl_builder{*builder};
228229
while (count > 0) {
229-
auto const val = protozero::decode_varint(&begin, end);
230+
auto const val =
231+
protozero::decode_zigzag64(protozero::decode_varint(&begin, end));
230232
wnl_builder.add_node_ref(delta.update(val));
231233
--count;
232234
}

0 commit comments

Comments
 (0)