From: Jeff King <peff@peff.net>
To: Junio C Hamano <gitster@pobox.com>
Cc: git@vger.kernel.org, Elijah Newren <newren@gmail.com>
Subject: Re: [PATCH 1/4] merge-recursive: silence -Wxor-used-as-pow warning
Date: Sat, 25 Jan 2020 14:55:15 -0500 [thread overview]
Message-ID: <20200125195515.GB5519@coredump.intra.peff.net> (raw)
In-Reply-To: <xmqq4kwjcupj.fsf@gitster-ct.c.googlers.com>
On Sat, Jan 25, 2020 at 09:27:36AM -0800, Junio C Hamano wrote:
> > So let's keep the bit-flipping, but let's also put it behind a named
> > function, which will make its purpose a bit clearer. This also has the
> > side effect of suppressing the warning (and an optimizing compiler
> > should be able to easily turn it into a constant as before).
>
> OK. Now I see you named it flip_stage(), which is even better than
> "the-other-side" above. Makes sense.
>
> I still think ((2 + 3) - two_or_three_to_be_flipped) easier to
> reason about than the bit flipping, as the implementation detail,
> though.
Yeah, the existing one relies on the coincidence that the two stages
differ by a single bit (in another universe, they could well be stages
"3" and "4").
I don't overly care on the implementation either way, since it's now
hidden in the helper. I mostly chose the bit-flip to match the existing
code, but I'd be happy to change it. Other people who actually work on
merge-recursive may have other opinions, though.
-Peff
next prev parent reply other threads:[~2020-01-25 19:55 UTC|newest]
Thread overview: 17+ messages / expand[flat|nested] mbox.gz Atom feed top
2020-01-25 5:35 [PATCH 0/4] more clang/sanitizer fixes Jeff King
2020-01-25 5:37 ` [PATCH 1/4] merge-recursive: silence -Wxor-used-as-pow warning Jeff King
2020-01-25 17:27 ` Junio C Hamano
2020-01-25 19:55 ` Jeff King [this message]
2020-01-25 20:50 ` Elijah Newren
2020-01-25 23:57 ` Jeff King
2020-01-27 19:17 ` Junio C Hamano
2020-01-25 5:38 ` [PATCH 2/4] avoid computing zero offsets from NULL pointer Jeff King
2020-01-27 20:03 ` Junio C Hamano
2020-01-27 21:19 ` Jeff King
2020-01-28 18:03 ` Junio C Hamano
2020-01-29 2:31 ` Jeff King
2020-01-29 5:16 ` Junio C Hamano
2020-01-29 5:46 ` Jeff King
2020-01-25 5:39 ` [PATCH 3/4] xdiff: avoid computing non-zero offset " Jeff King
2020-01-25 5:41 ` [PATCH 4/4] obstack: avoid computing offsets " Jeff King
2020-01-25 5:44 ` [PATCH v2 " Jeff King
Reply instructions:
You may reply publicly to this message via plain-text email
using any one of the following methods:
* Save the following mbox file, import it into your mail client,
and reply-to-all from there: mbox
Avoid top-posting and favor interleaved quoting:
https://en.wikipedia.org/wiki/Posting_style#Interleaved_style
List information: http://vger.kernel.org/majordomo-info.html
* Reply using the --to, --cc, and --in-reply-to
switches of git-send-email(1):
git send-email \
--in-reply-to=20200125195515.GB5519@coredump.intra.peff.net \
--to=peff@peff.net \
--cc=git@vger.kernel.org \
--cc=gitster@pobox.com \
--cc=newren@gmail.com \
/path/to/YOUR_REPLY
https://kernel.org/pub/software/scm/git/docs/git-send-email.html
* If your mail client supports setting the In-Reply-To header
via mailto: links, try the mailto: link
Be sure your reply has a Subject: header at the top and a blank line
before the message body.
Code repositories for project(s) associated with this public inbox
https://80x24.org/mirrors/git.git
This is a public inbox, see mirroring instructions
for how to clone and mirror all data and code used for this inbox;
as well as URLs for read-only IMAP folder(s) and NNTP newsgroup(s).