From: Jeff King Date: Fri, 11 Oct 2019 18:05:07 GMT Subject: Re: [RFC PATCH 04/10] ewah/bitmap: always allocate 2 more words Message-ID: <20191011180507.GB20601@sigill.intra.peff.net> In-Reply-To: On Fri, Oct 11, 2019 at 09:49:53AM +0200, Christian Couder wrote: > > I think this should be squashed with patch 3, adding to that commit > > message "since word_alloc might be 0, we need to change the growth > > function". (Or just make the minimum word_alloc be 1 or 32 or something > > positive, if that's possible.) > > Yeah, thank you for the suggestion. I still wonder why 2 is added > instead of just 1 though. Yeah, I think it should be squashed. I think it is not intentionally 2, it is just that adding "1" to block makes sure we always make forward progress. It could equally well be: self->word_alloc = block ? block * 2 : 1; I think. Or probably this whole thing could be ALLOC_GROW(), as the numbers aren't particularly important. I guess we need to make sure the grown part is zero'd, so probably using alloc_nr() directly would make more sense. -Peff