[Top][All Lists]

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

Re: [avr-gcc-list] odd left-shift behavior, avr-gcc 4.1.2

From: John Regehr
Subject: Re: [avr-gcc-list] odd left-shift behavior, avr-gcc 4.1.2
Date: Sun, 9 Dec 2007 23:09:58 -0700 (MST)

> The native int size on your x86 compiler is probably 32 bits.  Each
> argument to the shift is promoted to int first; that's the bit about
> "integer promotions" and this gets you answer you're expecting.  I
> believe the native int size on avr-gcc is 16 bits, so your left operand:
>   ((uint16_t)0xffffL)
> stays at 16 bits on the AVR.

Ok, thanks for bearing with me... I had been under the impression that 
shift requires both operands to have the same width (there are web pages 
that appear to say this), but a close read of the spec says that the 
result of a shift is the type of the promoted left operand.

John Regehr

reply via email to

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