Groups | Search | Server Info | Keyboard shortcuts | Login | Register [http] [https] [nntp] [nntps]
Groups > linux.kernel > #1329169
| From | Andy Shevchenko <andy.shevchenko@gmail.com> |
|---|---|
| Newsgroups | linux.kernel |
| Subject | Re: [PATCH 1/2] Staging:iio:Prefer using BIT macro |
| Date | 2016-02-08 16:20 +0100 |
| Message-ID | <qZVLA-74r-29@gated-at.bofh.it> (permalink) |
| References | <qZNXI-1zU-3@gated-at.bofh.it> <qZNXI-1zU-1@gated-at.bofh.it> <qZQ9c-3eh-19@gated-at.bofh.it> |
| Organization | linux.* mail to news gateway |
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
Back to linux.kernel | Previous | Next — Previous in thread | Find similar | Unroll thread
[PATCH 1/2] Staging:iio:Prefer using BIT macro Bhumika Goyal <bhumirks@gmail.com> - 2016-02-08 08:00 +0100
Re: [PATCH 1/2] Staging:iio:Prefer using BIT macro Lars-Peter Clausen <lars@metafoo.de> - 2016-02-08 10:20 +0100
Re: [PATCH 1/2] Staging:iio:Prefer using BIT macro Andy Shevchenko <andy.shevchenko@gmail.com> - 2016-02-08 16:20 +0100
csiph-web