linux-iio.vger.kernel.org archive mirror
 help / color / mirror / Atom feed
From: Andy Shevchenko <andy.shevchenko@gmail.com>
To: Lars-Peter Clausen <lars@metafoo.de>
Cc: Bhumika Goyal <bhumirks@gmail.com>,
	Greg Kroah-Hartman <gregkh@linuxfoundation.org>,
	Michael Hennerich <Michael.Hennerich@analog.com>,
	jic23@kernel.org, knaack.h@gmx.de,
	Peter Meerwald-Stadler <pmeerw@pmeerw.net>,
	linux-iio@vger.kernel.org, devel@driverdev.osuosl.org,
	"linux-kernel@vger.kernel.org" <linux-kernel@vger.kernel.org>
Subject: Re: [PATCH 1/2] Staging:iio:Prefer using BIT macro
Date: Mon, 8 Feb 2016 17:11:44 +0200	[thread overview]
Message-ID: <CAHp75Vf4V1w3_8rF3ukf9Lydd9OGg7pTeAsiUXiqognD4Mp36g@mail.gmail.com> (raw)
In-Reply-To: <56B85C88.7040506@metafoo.de>

On Mon, Feb 8, 2016 at 11:14 AM, Lars-Peter Clausen <lars@metafoo.de> wrote:
> On 02/08/2016 07:48 AM, Bhumika Goyal wrote:

>>               value = (s8)((data >> AD7816_TEMP_FLOAT_OFFSET) - 103);
>>               data &= AD7816_TEMP_FLOAT_MASK;
>>               if (value < 0)
>> -                     data = (1 << AD7816_TEMP_FLOAT_OFFSET) - data;
>> +                     data = BIT(AD7816_TEMP_FLOAT_OFFSET) - data;
>
>
> But in this case this is a false positive. The intended semantic meaning
> here is 2**... not BIT(...). Using BIT() here in my opinion only causes
> confusion.

+1. Here clearly the intention is to change sign of the value which
fits less than 32/16/8 bits. 1 << OFFSET represents '-0'.

-- 
With Best Regards,
Andy Shevchenko

  reply	other threads:[~2016-02-08 15:17 UTC|newest]

Thread overview: 6+ messages / expand[flat|nested]  mbox.gz  Atom feed  top
2016-02-08  6:48 [PATCH 0/2] Staging:iio:adc:Prefer using BIT macro Bhumika Goyal
2016-02-08  6:48 ` [PATCH 1/2] Staging:iio:Prefer " Bhumika Goyal
2016-02-08  9:14   ` Lars-Peter Clausen
2016-02-08 15:11     ` Andy Shevchenko [this message]
2016-02-08  6:48 ` [PATCH 2/2] Staging: iio: adc: Prefer using the " Bhumika Goyal
2016-02-08  9:16   ` Lars-Peter Clausen

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=CAHp75Vf4V1w3_8rF3ukf9Lydd9OGg7pTeAsiUXiqognD4Mp36g@mail.gmail.com \
    --to=andy.shevchenko@gmail.com \
    --cc=Michael.Hennerich@analog.com \
    --cc=bhumirks@gmail.com \
    --cc=devel@driverdev.osuosl.org \
    --cc=gregkh@linuxfoundation.org \
    --cc=jic23@kernel.org \
    --cc=knaack.h@gmx.de \
    --cc=lars@metafoo.de \
    --cc=linux-iio@vger.kernel.org \
    --cc=linux-kernel@vger.kernel.org \
    --cc=pmeerw@pmeerw.net \
    /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).