From: Grissiom <cha...@gm...> - 2010-03-30 14:13:52
|
On Tue, Mar 30, 2010 at 8:34 PM, Kustaa Nyholm <Kus...@pl...>wrote: > > > This approach requires two byte more RAM. > That is true > > >Then bitwise operation or ((unsigned char *)&add)[0] method. > > I did not quite follow what you wrote ... but extrapolating > that you were offering ((unsigned char *)&add)[0] as a better > alternative, shouldn't that be *((unsigned char *)&add)[0]? > > I just need to divide the pointer into high/low byte but not need to get the content of high/low address pointed to ;) > Also SDCC/PIC generates poor code for pointers ...especially > for generic pointers, so *((__data unsigned char *)&add)[0] > could potentially be better. Don't know how well the > optimizer would optimize any of above but I do know that > access to global variables/arrays with constant indexes > and struct members with are handled reasonably optimized. > > I have only used sdcc to develop mcs51 programs. And the generate pointer there is 3 bytes long. The format is a bit complicated to handle.(But I think it's complicated for compiler, users need not to take care of that in most cases) -- Cheers, Grissiom |