[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 a multi-b
From: |
Vincent Trouilliez |
Subject: |
Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ? |
Date: |
Fri, 04 Nov 2005 09:42:23 +0100 |
On Fri, 2005-11-04 at 15:20 +0800, Ian Caddy wrote:
> Hi Vince,
>
> All your new code is doing is checking that address is non-zero as it is
> a logical AND with a non-zero number, which would get optimised out.
>
> I haven't tried this, but it might be better:
>
> unsigned char temp;
>
> temp = (address >> 16) & 0xFF;
>
> if(temp & 0x04)
Thank you very much Ian, your code is highly efficient, and does work
perfectly, unlike && or &. :o) I am in heaven :
temp = (address >> 16) & 0xFF;
28bc: ca 01 movw r24, r20
28be: aa 27 eor r26, r26
28c0: bb 27 eor r27, r27
if (temp & 0x04)
28c2: 82 ff sbrs r24, 2
28c4: 02 c0 rjmp .+4 ; 0x28ca
can't get any better than that really :o)))
Thanks again
--
Vince
- [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 ?, Vincent Trouilliez, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?, Royce Pereira, 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 ?, Ian Caddy, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within a multi-byte integer ?,
Vincent Trouilliez <=
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ?, Jurek Szczesiul, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit within amulti-byte integer ?, Vincent Trouilliez, 2005/11/04
- RE: [avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ?, niklo, 2005/11/04
- RE: [avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte integer ?, Vincent Trouilliez, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bit withinamulti-byte intege, Dave Hansen, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test a bitwithinamulti-byte intege, David Brown, 2005/11/04
- Re: [avr-gcc-list] How to (efficeiently !!!) test abitwithinamulti-byte intege, Dave Hansen, 2005/11/04
- 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