[linux-dvb] Problems with ca_zap

Edgar Toernig froese at gmx.de
Fri Jun 24 16:05:12 CEST 2005


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.




More information about the linux-dvb mailing list