WIP
This commit is contained in:
parent
9a6ea9519a
commit
3e3ca8db5e
|
@ -1264,6 +1264,12 @@ sparsemap_merge(sparsemap_t *map, sparsemap_t *other)
|
||||||
for (size_t i = 0; i < max_chunk_count && src_count; i++) {
|
for (size_t i = 0; i < max_chunk_count && src_count; i++) {
|
||||||
sm_idx_t dst_start = *(sm_idx_t *)dst;
|
sm_idx_t dst_start = *(sm_idx_t *)dst;
|
||||||
sm_idx_t src_start = *(sm_idx_t *)src;
|
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) {
|
if (src_start == dst_start && dst_count > 0) {
|
||||||
/* Chunks overlap, merge them. */
|
/* Chunks overlap, merge them. */
|
||||||
__sm_chunk_t src_chunk;
|
__sm_chunk_t src_chunk;
|
||||||
|
|
|
@ -702,7 +702,6 @@ test_api_merge(const MunitParameter params[], void *data)
|
||||||
}
|
}
|
||||||
|
|
||||||
sparsemap_merge(map, other);
|
sparsemap_merge(map, other);
|
||||||
|
|
||||||
assert(sparsemap_is_set(map, 0));
|
assert(sparsemap_is_set(map, 0));
|
||||||
assert(sparsemap_is_set(map, 2048));
|
assert(sparsemap_is_set(map, 2048));
|
||||||
assert(sparsemap_is_set(map, 8193));
|
assert(sparsemap_is_set(map, 8193));
|
||||||
|
|
Loading…
Reference in a new issue