From: Jeff King Date: Fri, 10 Nov 2023 22:09:43 GMT Subject: Re: [PATCH 1/7] chunk-format: introduce `pair_chunk_expect()` helper Message-ID: <20231110220943.GJ2758295@coredump.intra.peff.net> In-Reply-To: <20231110215747.GG2758295@coredump.intra.peff.net> On Fri, Nov 10, 2023 at 04:57:47PM -0500, Jeff King wrote: > One of those patches calls out the truncating division issue, but to > summarize: IMHO this is OK, as what we really want to know is "is it big > enough that we can always ask for NR records of size ELEM", which > division gives us. If we do want to be more precise, but also avoid > die(), we'd need a variant of st_mult() that returns a boolean. I didn't > think it was worth it for this case (but arguably it is something that > would be useful to have in general). Oh, and obviously there is another option here if we want to be more careful but don't want to introduce an st_mult() variant: we can use "%" to check for divisibility ourselves. I don't think it's worth doing that in every individual size-check, but maybe it would be in a central pair_chunk_expect(). -Peff