This commit is contained in:
Gregory Burd 2024-04-30 11:17:37 -04:00
parent 9a6ea9519a
commit 3e3ca8db5e
2 changed files with 6 additions and 1 deletions

View file

@ -1264,6 +1264,12 @@ sparsemap_merge(sparsemap_t *map, sparsemap_t *other)
for (size_t i = 0; i < max_chunk_count && src_count; i++) {
sm_idx_t dst_start = *(sm_idx_t *)dst;
sm_idx_t src_start = *(sm_idx_t *)src;
if (src_start > dst_start && dst_count > 0) {
__sm_chunk_t dst_chunk;
__sm_chunk_map_init(&dst_chunk, dst + sizeof(sm_idx_t));
dst += sizeof(sm_idx_t) + __sm_chunk_map_get_size(&dst_chunk);
continue;
}
if (src_start == dst_start && dst_count > 0) {
/* Chunks overlap, merge them. */
__sm_chunk_t src_chunk;

View file

@ -702,7 +702,6 @@ test_api_merge(const MunitParameter params[], void *data)
}
sparsemap_merge(map, other);
assert(sparsemap_is_set(map, 0));
assert(sparsemap_is_set(map, 2048));
assert(sparsemap_is_set(map, 8193));