Allan Stirling wrote: > From pat.c: > > static uint16_t parse_descriptor(struct program_descriptor > *p_program_descriptor, > uint8_t > *buf, uint16_t pos) > { > p_program_descriptor->program_number = > ((p_program_descriptor->program_number | buf[pos + 0]) << > 8) | buf[pos + 1]; > > Doesn't look quite right. Why do we care what the program_number is > before it's been parsed? > Hmm, that is required because buf is 8 bits. All what i do is, get buf into program_number and shift program_number to the left by 8. > 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 problem would be solved, if program_number is initialized to 0 just before reading in from the buffer. Manu