linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Lars-Peter Clausen <lars@metafoo.de>
To: Jonathan Cameron <jic23@kernel.org>,
	"zhaoxiu.zeng" <zhaoxiu.zeng@gmail.com>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	Hartmut Knaack <knaack.h@gmx.de>,
	Peter Meerwald <pmeerw@pmeerw.net>
Cc: linux-kernel@vger.kernel.org, linux-iio@vger.kernel.org
Subject: Re: [PATCH 28/31] iio: gyro: use parity32 in adxrs450.c
Date: Mon, 28 Mar 2016 10:50:13 +0200	[thread overview]
Message-ID: <56F8F045.7060409@metafoo.de> (raw)
In-Reply-To: <56F8ECDE.3010701@kernel.org>

On 03/28/2016 10:35 AM, Jonathan Cameron wrote:
> On 27/03/16 08:42, zhaoxiu.zeng wrote:
>> From: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
>>
>> Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@gmail.com>
> Interesting.  Whilst obviously correct I wonder if this obscures the
> intent of the code a little. Lars, what do you think?

The parity function is newly introduced in this series and can be more
efficient that  just hw_weight() & 1 on certain architectures. Since the
result is the same using it is certainly an improvement. But ...

[...]
>> -	if (!(hweight32(tx) & 1))
>> -		tx |= ADXRS450_P;
>> +	tx |= !parity32(tx) * ADXRS450_P;

... this should still be

if (!parity32(tx))
	tx |= ADXRS450_P;

Otherwise it's a bit too much obfuscated for my taste. Just leave it to the
compiler to optimize it as it sees it fit.

      reply	other threads:[~2016-03-28  8:53 UTC|newest]

Thread overview: 3+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
     [not found] <1458788612-4367-1-git-send-email-zhaoxiu.zeng@gmail.com>
2016-03-27  7:42 ` [PATCH 28/31] iio: gyro: use parity32 in adxrs450.c zhaoxiu.zeng
2016-03-28  8:35   ` Jonathan Cameron
2016-03-28  8:50     ` Lars-Peter Clausen [this message]

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

* Reply using the --to, --cc, and --in-reply-to
  switches of git-send-email(1):

  git send-email \
    --in-reply-to=56F8F045.7060409@metafoo.de \
    --to=lars@metafoo.de \
    --cc=Michael.Hennerich@analog.com \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    --cc=zhaoxiu.zeng@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.
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 NNTP newsgroup(s).