[Top][All Lists]

[Date Prev][Date Next][Thread Prev][Thread Next][Date Index][Thread Index]

Re: [avr-gcc-list] efficiency of assigning bits

From: E. Weddington
Subject: Re: [avr-gcc-list] efficiency of assigning bits
Date: Fri, 18 Mar 2005 11:11:05 -0700
User-agent: Mozilla Thunderbird 0.7.3 (Windows/20040803)

Royce & Sharal Pereira wrote:

3. IIRC, a constant defaults to an *integer*, which on the AVR is 16 bits. It does not default to an unsigned char. So you still have the same problem and you will still have to typecast the constants.

I dont know...check this code result (from the .lss file):
      PORTD= (PORTD & ~1) |(1<<2) |(1<<3);
 924:    82 b3           in    r24, 0x12    ; 18
 926:    8e 7f           andi    r24, 0xFE    ; 254
 928:    8c 60           ori    r24, 0x0C    ; 12
 92a:    82 bb           out    0x12, r24    ; 18

That just means that optimizer was able to correctly determine that the sizes of the constant operands would fit in an unsigned char.

Sometimes the compiler has put out some strange stuff that shows that some operands of the bit operators are getting promoted to an integer (16-bit on the AVR).


reply via email to

[Prev in Thread] Current Thread [Next in Thread]