[linux-dvb] Problems with ca_zap

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

 



Manu Abraham wrote:
>
> Allan Stirling wrote:
> >
> > If I change this to
> > 
> >        p_program_descriptor->program_number =
> >                ( buf[pos + 0] << 8) | buf[pos + 1];
> > 
> 
> This would be wrong however, since if you left shift an 8 bit buffer by 
> 8 all you will get is 0.

The code is fine as long as buf is unsigned.  There's no 8-bit
arithmetic in C - chars are always expanded to ints.  And btw,
shifting by the width of the (expanded) left operand is undefined,
not 0.

Ciao, ET.



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

  Powered by Linux