[alsa-devel] [PATCH 5/7] ASoC: wm5100: remove bitwise operations involving GPIO level value

Mark Brown broonie at kernel.org
Wed Jun 3 13:07:45 CEST 2015


On Wed, Jun 03, 2015 at 03:50:04AM -0700, Trent Piepho wrote:

> BTW, with a little C algebra:
> const unsigned int val = value ?  0x1 << WM5100_GP1_LVL_SHIFT : 0;
> const unsigned int val = (value ?  0x1 : 0) << WM5100_GP1_LVL_SHIFT;
> const unsigned int val = (!!value) << WM5100_GP1_LVL_SHIFT;  // definition
> of ! operator

> And now we're back to where we started, so I don't really see why this is
> even necessary.  The semantics of the ! operator will be changed in a
> future C version?

Yes, this is exactly the point I was trying to make.
-------------- next part --------------
A non-text attachment was scrubbed...
Name: signature.asc
Type: application/pgp-signature
Size: 473 bytes
Desc: Digital signature
URL: <http://mailman.alsa-project.org/pipermail/alsa-devel/attachments/20150603/a8939fc2/attachment.sig>


More information about the Alsa-devel mailing list