On Mon, 10 Nov 2003, Herbert Graf wrote: > say I have an int number > I want the upper 16 bits of this number I assume you meant upper 8 bits? unsigned char c; int i; c = i >> 8; generates optimal code. So will a union, but the above is more portable. > right now I'm doing it like this: > (char)(number/256) If "number" is an unsigned int, it will also generate optimal code; i.e., it doesn't actually do a division. -- John W. Temples, III -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.