[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
RE: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values
From: |
Alex Shepherd |
Subject: |
RE: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values |
Date: |
Mon, 27 Oct 2003 22:33:51 +1300 |
Hi David,
Ah-huh!
Thanks for your comments and insights, I think I understand what is
going on now. I played with the code some more today and found I was
able to make the problem go away by changing to: Mask <<= 1; in the
for(;;) loop.
> What is really needed here is an ^^ operator:
> if ( (LN_TX_PORT & ( 0x01 << LN_TX_BIT )) ^^
> (LN_RX_PORT & ( 0x01 << LN_RX_BIT )) ) ...
Yeah, that is what I thought too as it felt like a XOR solution was
hiding in there somewhere. I had asked a fairly knowledgeable C/C++
friend of mine, he couldn't come up with anything better. However
neither he nor I had really dealt with things this small before.
Guess I need to play around with the code and see what the compiler does
for various test cases, now you have shed some light on the underlying
issues.
Previously I had been working on a large financial model evaluation
system written in Java that initially chewed up about 2.5G of RAM on a
dual CPU DEC Alpha box, so we were happy to get it down under 1G, using
the various code optimisation tools we had.
However, all this is a far cry from saving the odd 20-30 bytes here and
there but it all adds up to fit/no-fit into a Mega8 pretty quickly.
Thanks for your explanations.
Cheers
Alex
- [avr-gcc-list] RE: eeprom section and ld scripts, Bill Somerville, 2003/10/25
- [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Alex Shepherd, 2003/10/26
- Re: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Neil Johnson, 2003/10/26
- Re: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Theodore A. Roth, 2003/10/26
- Re: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Neil Johnson, 2003/10/26
- RE: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Alex Shepherd, 2003/10/26
- Re: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, David Brown, 2003/10/27
- RE: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values,
Alex Shepherd <=
- Re: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Neil Johnson, 2003/10/27
- RE: [avr-gcc-list] 8 bit bitwise operation promoted to 16 bit values, Neil Johnson, 2003/10/27