Hi Herbert, I'm not an expert with PicCLite (more experience in c) but: for an int with 32bits if you want to have the upper 16 bits you can - do a right shifting which is perhaps not suitable for Pic .... - use a union (the generated code has to be checked) - use a cast like *(((short*)&number)+1) - or access directly the upper 16 bit of this int if you know the memory organization. Regards, Nicolas > Having some problems getting code to fit within the constraints of PICClite. > > One area that is costing me quite a bit, I believe, is trying to access > singular bytes of a multibyte structure. For example: > > say I have an int number > I want the upper 16 bits of this number > > right now I'm doing it like this: > (char)(number/256) > > Ugly, I know. Is it possible to access the upper byte using a union? > Is a sort of union structure already built in? Something like number.hi? > Does PICCLite recognize what I'm doing with that statement and generate the > right, small code? > > Perhaps using a pointer will do? Something like: > (char)(*(&number+1))? > > Any other hints on how I might optimize code for PICC? > > Thanks for any help. TTYL -- http://www.piclist.com hint: The PICList is archived three different ways. See http://www.piclist.com/#archives for details.