Thread (1 message) 1 message, 1 author, 2021-09-08

Re: [PATCH] pack-write: skip *.rev work when not writing *.rev

From: Junio C Hamano <hidden>
Date: 2021-09-08 15:47:33

Taylor Blau [off-list ref] writes:
On Tue, Sep 07, 2021 at 06:35:10PM -0700, Carlo Arenas wrote:
quoted
On Tue, Sep 7, 2021 at 6:10 PM Ævar Arnfjörð Bjarmason [off-list ref] wrote:
quoted
+       if (!(flags & WRITE_REV) && !(flags & WRITE_REV_VERIFY))
+               return NULL;
I see this expression matches exactly the logic from 8ef50d9958 which
is why I presume
you used it, but the simpler (and logically equivalent[1]) :

  if !((flags & WRITE_REV) || (flags & WRITE_REV_VERIFY))
Even simpler would be:

    if (!(flags & (WRITE_REV | WRITE_REV_VERIFY)))

although with optimization flags other than -O0, it seems that each of
these three produce the same result [1], so I don't think that it
matters much either way ;-).
If all result in the same binary, the only deciding factor would be
how readable the code is to human readers.

I too find that your version, "we care about these two bits---if
flags does not have either of them, then...", the easiest to follow.
But the original is not unreadable and is good enough once it has
already been written.

Thanks.
Keyboard shortcuts
hback out one level
jnext message in thread
kprevious message in thread
ldrill in
Escclose help / fold thread tree
?toggle this help