[Top][All Lists]
[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-by
From: |
Derric Tubbs |
Subject: |
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ? |
Date: |
Fri, 4 Nov 2005 20:15:29 -0800 (PST) |
Empty loops and optimization don't go together. Also
check to ensure you're using 'volatile' where
appropriate. I'm running into this same problem with
some inherited code at work right now.
Tubbs
--- Vincent Trouilliez
<address@hidden> wrote:
> On Fri, 2005-11-04 at 10:04 +0100, Jurek Szczesiul
> wrote:
> > Hi Vince !
> > You could also try to retrieve directly the 2. (
> from 0) byte of ulong and check
> > the bit , something like this ( -Os) :
> >
> > if( *((uchar*)&long1+2) & 0x4) PORTB = 0x1;
> > 8c: 80 91 65 00 lds r24, 0x0065
> > 90: 82 ff sbrs r24, 2
> > 92: 02 c0 rjmp .+4 ; 0x98
> > 94: 81 e0 ldi r24, 0x01 ; 1
> > 96: 88 bb out 0x18, r24 ; 24
>
> Using pointers to access directly the required byte,
> I did think of it,
> but didn't dare ! ;-) It's technically elegant I
> find, but sadly the
> code is not very easy to read I find.
>
> About the -Os flag, I noticed this morning that it
> managed MASSIVE code
> size reduction ! SO far I had been using just -O (I
> guess that means no
> particular optimisation ?), and the program is about
> 13KB in size. With
> -Os, it's only 10KB !!! Sadly, for some reason,
> when compiled with this
> flag, my program misbehaves badly (I get massive
> corruption of the LCD
> display) !! Too bad... :o(
>
>
>
> --
> Vince
>
>
>
> _______________________________________________
> AVR-GCC-list mailing list
> address@hidden
>
http://lists.nongnu.org/mailman/listinfo/avr-gcc-list
>
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, (continued)
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Dave Hylands, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Vincent Trouilliez, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Joerg Wunsch, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Vincent Trouilliez, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Joerg Wunsch, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Vincent Trouilliez, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) testabitwithinamulti-byte intege, Dave Hansen, 2005/11/07
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege, Vincent Trouilliez, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege, David Kelly, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege, Vincent Trouilliez, 2005/11/05
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ?,
Derric Tubbs <=
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Alex Wenger, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Vincent Trouilliez, 2005/11/04
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Bernard Fouché, 2005/11/04
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Bernard Fouché, 2005/11/04
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Vincent Trouilliez, 2005/11/05
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, David Kelly, 2005/11/05
RE: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ?, Niklas Lövgren, 2005/11/05