Compilerguru,
yes, it's not the case using Codewarrior S12(X), that char * 0x10000 or short * 0x10000 are chopped to 16bits. I'm not sure if this should be the same using other compilers. I believed that constant isn't long without L suffix, even if it is more than 0xFFFF. Is it? In all compilers? You must be right, I should consult C specs.
So what result from above should give for char BYTE4..1 set to 0xF4,0xF3..0xF1?
a).BYTEn are unsigned char's:
byte4 * 0x1000000 should give 0xF4000000, of course if constant is treated as long.
byte3 * 0x10000 , should give 0x00F30000
byte2 * 0x100 gives int = 0xF200, which is then sign extended to long givinh 0xFFFFF200
byte1 directly converted to long gives 0x000000F1.
The sum should be 0xF4F2F2F1
b) BYTEn are signed char's:
byte4 * 0x1000000 should give 0xF4000000
byte3 * 0x10000 , should give 0xFFF30000
byte2 * 0x100 gives int = 0xF200, which is then sign extended to long givinh 0xFFFFF200
byte1 directly converted to long gives 0xFFFFFFF1.
The sum should be 0xF3F2F1F1