I give up. I've been trying to shift 4 chars into an unsigned long,
but can't stop GCC 3.4.1 (what's shipped with the latest WinAVR) from
sign extending values, let alone producing sane code.
I've tried -Os, -O2, -O3, with and without -fnew-ra... the asm varies,
but is generaly crap.
now, if I have:
extern char a[4];
unsigned long ul;
ul = ( (unsigned)a[0] << 8 ) | (unsigned)a[1];
why would it be sign extending a[0] and a[1] when they're cast to
unsigneds?
And then why doesn't the code optimiser see to just mov rX, a[1]; mov
rX+1,a[0] ?
I tried casts on casts on casts... everything I could think of to get
better code, and it just did not improve.