Hi! i want to spilt the 16bit word into two 8bit words, is there any key words for it. i use the p89V51 mcu and c language Cx51 keil compiler ver3.
regards, K.T.Venkatesan.
"I can't see any advantage of division & modulus over shift & mask ..."
Right-shifting an int having a negative value is implementation-defined, whereas div/mod are not.
It would be nice if that were true, but actually this only holds if your compiler claims compliance to C99.
In the original standardized version of the language, C90, which still has to be considered the default assumption for portable code, division of negative numbers is implementation-defined, too. (-1)/2 can yield either -1 or 0; (-1)%2 can be either -1 or 1.