From: Jeff King Date: Thu, 01 Aug 2024 09:39:47 GMT Subject: Re: [PATCH v2 06/19] midx: teach `nth_bitmapped_pack()` about incremental MIDXs Message-ID: <20240801093947.GF1159276@coredump.intra.peff.net> In-Reply-To: <650b8c8c21b7e8a6e4f65d9b47185a875f0022bb.1721250704.git.me@ttaylorr.com> On Wed, Jul 17, 2024 at 05:12:13PM -0400, Taylor Blau wrote: > In a similar fashion as in previous commits, teach the function > `nth_bitmapped_pack()` about incremental MIDXs by translating the given > `pack_int_id` from the concatenated lexical order to a MIDX-local > lexical position. > > When accessing the containing MIDX's array of packs, use the local pack > ID. Likewise, when reading the 'BTMP' chunk, use the MIDX-local offset > when accessing the data within that chunk. OK, makes sense. > int nth_bitmapped_pack(struct repository *r, struct multi_pack_index *m, > struct bitmapped_pack *bp, uint32_t pack_int_id) > { > + uint32_t local_pack_int_id = midx_for_pack(&m, pack_int_id); > + Heh, after the last one reused the "n" variable, now we are back to a separate local variable. Not wrong, but curious to go back and forth. -Peff