Re: [v4l-dvb-maintainer] [PATCH] [rivers/media/video/tvaudio.c] add parentheses

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

 



Hi,

On Sun, 3 Feb 2008, Bodo Eggert wrote:

> Roel Kluin <12o3l@xxxxxxxxxx> wrote:
> 
> > '!' has a higher priority than '&': bitanding has no effect.
> 
> > +++ b/drivers/media/video/tvaudio.c
> > @@ -1571,14 +1571,14 @@ static int tvaudio_get_ctrl(struct CHIPSTATE *chip,
> >  ctrl->value=chip->muted;
> >  return 0;
> >  case V4L2_CID_AUDIO_VOLUME:
> > -             if (!desc->flags & CHIP_HAS_VOLUME)
> > +             if (!(desc->flags & CHIP_HAS_VOLUME))
> 
> This is a cosmetic change, because:
> 
> !1100101 & 0000100 == 0011010 & 0000100 == 0 /* false */
> !(1100101 & 0000100) == !0000100 == 0 /* false */
> 
> !1100001 & 0000100 == 0011110 & 0000100 == 0000100 /* non-false */
> !(1100001 & 0000100) == !0000000 == 1 /* non-false */
> 
> 
> OTOH, your change may result in better code by using a negated jump instead of
> explicitely negating the value.

If I'm not totally wrong, ! is negating integers: !123 == 0. At least I 
hope that, otherwise I have to go through a lot of code ;)

Your interpretation of ! is actually achieved by using ~ .

Patrick.

_______________________________________________
linux-dvb mailing list
linux-dvb@xxxxxxxxxxx
http://www.linuxtv.org/cgi-bin/mailman/listinfo/linux-dvb

[Index of Archives]     [Linux Media]     [Video 4 Linux]     [Asterisk]     [Samba]     [Xorg]     [Xfree86]     [Linux USB]

  Powered by Linux