On Tue, Mar 30, 2010 at 8:34 PM, Kustaa Nyholm <Kustaa.Nyholm@planmeca.com>
That is true
> This approach requires two byte more RAM.
I did not quite follow what you wrote ... but extrapolating
>Then bitwise operation or ((unsigned char *)&add) method.
that you were offering ((unsigned char *)&add) as a better
alternative, shouldn't that be *((unsigned char *)&add)?
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)
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)