lkml.org 
[lkml]   [2021]   [Apr]   [18]   [last100]   RSS Feed
Views: [wrap][no wrap]   [headers]  [forward] 
 
Messages in this thread
    /
    Date
    From
    SubjectRe: [PATCH] media: atomisp: silence "dubious: !x | !y" warning
    On Sat, Apr 17, 2021 at 09:31:32PM +0000, David Laight wrote:
    > > > Upon running sparse, "warning: dubious: !x | !y" is brought to notice
    > > > for this file. Logical and bitwise OR are basically the same in this
    > > > context so it doesn't cause a runtime bug. But let's change it to
    > > > logical OR to make it cleaner and silence the Sparse warning.
    >
    > The old code is very likely to by slightly more efficient.
    >
    > It may not matter here, but it might in a really hot path.
    >
    > Since !x | !y and !x || !y always have the same value
    > why is sparse complaining at all.

    They both will have the same value here and any half-decent
    compiler know that and thus generate the same code, so no
    worries about efficiency.

    Sparse complains because the programmer's intention is not clear.
    Was a boolean context or a bitwise context that was meant?
    Maybe '||' was meant and the RHS had to be short cut?
    Maybe what was meant was '~x | ~y'?

    -- Luc

    \
     
     \ /
      Last update: 2021-04-19 00:02    [W:2.423 / U:0.228 seconds]
    ©2003-2020 Jasper Spaans|hosted at Digital Ocean and TransIP|Read the blog|Advertise on this site