[linux-dvb] Problems with ca_zap

Manu Abraham manu at kromtek.com
Fri Jun 24 19:06:17 CEST 2005


Edgar Toernig wrote:
> 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.


I believe uint8_t is 8 bits and u8 too .. i don't use char's in the code 
.. Take a look at ca_set_pmt() in dst_ca.c

What i am using is

1) u16 var | u8 var
2) u16 var << 8
3) u16 var | u8 var


Manu





More information about the linux-dvb mailing list