oops, it was an off-by-one error

This commit is contained in:
silverweed 2024-07-16 11:21:09 +02:00
parent 59301745ef
commit b8a23aa37a

View file

@ -112,7 +112,6 @@ void gather_metadata(Arena *arena, RMicroFileReader &reader, const RNTuple_File_
last_inserted_pinfo->next = pinfo; last_inserted_pinfo->next = pinfo;
} else for (Page_Info_Node *node = pinfo_head->next, *prev = pinfo_head; node; prev = node, node = node->next) { } else for (Page_Info_Node *node = pinfo_head->next, *prev = pinfo_head; node; prev = node, node = node->next) {
if (pinfo->range.end() <= node->range.start) { if (pinfo->range.end() <= node->range.start) {
printf("inserted 0x%lX - 0x%lX (previous was 0x%lX - 0x%lX)\n", pinfo->range.start, pinfo->range.end(), last_inserted_pinfo->range.start, last_inserted_pinfo->range.end());
prev->next = pinfo; prev->next = pinfo;
pinfo->next = node; pinfo->next = node;
++n_slow; ++n_slow;
@ -158,14 +157,12 @@ void gather_metadata(Arena *arena, RMicroFileReader &reader, const RNTuple_File_
// close current chunk and open new one // close current chunk and open new one
Page_Info_Chunk *chunk = arena_push<Page_Info_Chunk>(arena); Page_Info_Chunk *chunk = arena_push<Page_Info_Chunk>(arena);
chunk->range.start = pinfo->range.start; chunk->range.start = pinfo->range.start;
chunk->first_group = n_groups; chunk->first_group = n_groups - 1;
printf("closing chunk 0x%lX - 0x%lX, opening new at 0x%0lX\n", chunks_tail->range.start, chunks_tail->range.end(), pinfo->range.start);
chunks_tail->next = chunk; chunks_tail->next = chunk;
chunks_tail = chunk; chunks_tail = chunk;
++n_chunks; ++n_chunks;
} }
chunks_tail->range.len += pinfo->range.len; chunks_tail->range.len += pinfo->range.len;
printf("adding page 0x%lX - 0x%lX to chunk 0x%lX - 0x%lX\n", pinfo->range.start, pinfo->range.end(), chunks_tail->range.start, chunks_tail->range.end());
if (idx++ % GROUP_SIZE != 0) if (idx++ % GROUP_SIZE != 0)
continue; continue;