On Tue, Mar 30, 2010 at 4:28 PM, Sébastien Lorquet <firstname.lastname@example.org>
Aren't the (shortValue&0xFF) and (shortValue>>8) optimized ? I think they are, at least for pic16.
Yes they are optimized.(not shift a bit 8 times) But see the assembly code:
488 ; eeprom.c:21: IAP_ADDRH = (unsigned int)src >> 8;^M
489 mov ar0,r5
490 mov ar1,r6
491 mov _IAP_ADDRH,r1
492 ; eeprom.c:22: IAP_ADDRL = (unsigned int)src & 0x00FF;^M
493 mov r1,#0x00
494 mov _IAP_ADDRL,r0
It use the unnecessary r1 register and even clear it...