> > For 32 Bit / 64 Bit machines (assuming int is 32 bit and char is 8 bit). > Signed, unsigned makes no difference, assuming self-aligned (which is the > case on x86, x86_64 and ARM): >
If the char is signed you have to do bit sign extension, and for example transform 0x81 into 0xffffff81. Depend of the processor it can be done with only one instruction but in anothers you have to check the upper bit and branch based in its value. If the char is unsigned you always have to clear the upper bytes, so in the case of signed the code is longer and non linear (or even worse, the compiler calls an internal function to do the bit expansion). Regards,