From: Jeff King Date: Sat, 25 Jan 2020 19:55:15 GMT Subject: Re: [PATCH 1/4] merge-recursive: silence -Wxor-used-as-pow warning Message-ID: <20200125195515.GB5519@coredump.intra.peff.net> In-Reply-To: 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