[<prev] [next>] [<thread-prev] [thread-next>] [day] [month] [year] [list]
Message-ID: <56F8F045.7060409@metafoo.de>
Date: Mon, 28 Mar 2016 10:50:13 +0200
From: Lars-Peter Clausen <lars@...afoo.de>
To: Jonathan Cameron <jic23@...nel.org>,
"zhaoxiu.zeng" <zhaoxiu.zeng@...il.com>,
Michael Hennerich <Michael.Hennerich@...log.com>,
Hartmut Knaack <knaack.h@....de>,
Peter Meerwald <pmeerw@...erw.net>
Cc: linux-kernel@...r.kernel.org, linux-iio@...r.kernel.org
Subject: Re: [PATCH 28/31] iio: gyro: use parity32 in adxrs450.c
On 03/28/2016 10:35 AM, Jonathan Cameron wrote:
> On 27/03/16 08:42, zhaoxiu.zeng wrote:
>> From: Zeng Zhaoxiu <zhaoxiu.zeng@...il.com>
>>
>> Signed-off-by: Zeng Zhaoxiu <zhaoxiu.zeng@...il.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.
Powered by blists - more mailing lists