|
From: | Jim Brain |
Subject: | Re: [avr-gcc-list] efficiency of assigning bits |
Date: | Sat, 19 Mar 2005 14:52:11 -0600 |
User-agent: | Mozilla Thunderbird 1.0 (Windows/20041206) |
Graham Davies wrote:
I'll rephrase my statement. In my avr object code produced by GNU GCC concerning the (1<<X) construct, I've only seen the need to explicitly cast ~(1<<X) statements in order to force the optimizer/compiler to not generate integer based code in that circumstance.This has nothing to do with what the ANSI C specification requires. This just indicates that the optimizer has determined that the result will be the same whether the operands are processed as integers or at their declared
Which effectively "cancels" the promotion. I apologize for not using the pedantically correct terminology. I hope other readers were able to understand the essence of the statement.You can't "cancel" promotions. All you can do it take the result of an operand or expression evaluation and cast (perform an explicit conversion) to some type. This is what you are doing here.
Jim -- Jim Brain, Brain Innovations address@hidden http://www.jbrain.com Dabbling in WWW, Embedded Systems, Old CBM computers, and Good Times!
[Prev in Thread] | Current Thread | [Next in Thread] |