Re: [PATCH v7 03/13] pack-objects: use bitfield for object_entry::dfs_state
- From
Jeff King <peff@peff.net>
- Date
- Mar 30, 2018, 20:23 UTC
- Message-ID
- <20180330202347.GB14782@sigill.intra.peff.net>
- In-Reply-To
- <20180324063353.24722-4-pclouds@gmail.com>
On Sat, Mar 24, 2018 at 07:33:43AM +0100, Nguyễn Thái Ngọc Duy wrote:
> Signed-off-by: Nguyễn Thái Ngọc Duy <pclouds@gmail.com> > ---
This probably needs some explanation for people digging in history (even if it's "this is to shrink the size as part of a larger struct-shrinking effort" so they know to dig around in the nearby history).
Show 10 quoted lines
> diff --git a/builtin/pack-objects.c b/builtin/pack-objects.c
> index 647c01ea34..83f8154865 100644
> --- a/builtin/pack-objects.c
> +++ b/builtin/pack-objects.c
> @@ -3049,6 +3049,9 @@ int cmd_pack_objects(int argc, const char **argv, const char *prefix)
> OPT_END(),
> };
>
> + if (DFS_NUM_STATES > (1 << OE_DFS_STATE_BITS))
> + die("BUG: too many dfs states, increase OE_DFS_STATE_BITS");I thought this was off-by-one at first, but NUM_STATES is one more than the highest state, so it's right.
I suspect all of the dfs and depth stuff could be pulled into a separate array that is used only during that depth search. But as you have it squished down here, I think we may be getting it "for free" in between other non-word-aligned values in the struct.
-Peff