fn rebuildIndex(self: *Self, gpa: Allocator, ctx: Context) Oom!void 910
911
912
913
914
915
916
917
918
919
920 fn rebuildIndex(self: *Self, gpa: Allocator, ctx: Context) Oom!void {
if (self.entries.capacity <= linear_scan_max) return;
// We're going to rebuild the index header and replace the existing one (if any). The
// indexes should sized such that they will be at most 60% full.
const bit_index = try IndexHeader.findBitIndex(self.entries.capacity);
const new_header = try IndexHeader.alloc(gpa, bit_index);
if (self.index_header) |header| header.free(gpa);
self.insertAllEntriesIntoNewHeader(if (store_hash) {} else ctx, new_header);
self.index_header = new_header;
}