Performing a code review. I believe that + will actually be slower than | in this case, but I want a second, third. . . etc opinion:
Code:
unsigned short status;
unsigned char LSB, MSB;
LSB = <some value, but we don't care>;
MSB = <some other value, be we still don't care>;
status = ((MSB & 0xff) << 8) + (LSB & 0xff);
OR
Code:
unsigned short status;
unsigned char LSB, MSB;
LSB = <some value, but we don't care>;
MSB = <some other value, be we still don't care>;
status = ((MSB & 0xff) << 8) | (LSB & 0xff);
Which one of these will be faster (keeping in mind that the cross-compiler that is being used doesn't do _ANY_ optimization -- it is a compiler for the TI2808 DSP).
Thanks for your input,
Andy