[Top][All Lists]

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

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

From: John Regehr
Subject: [avr-gcc-list] odd left-shift behavior, avr-gcc 4.1.2
Date: Sat, 08 Dec 2007 22:46:33 -0700
User-agent: Thunderbird (X11/20071022)

Using avr-gcc 4.1.2, this code:

  int32_t x = ((uint16_t)0xffffL) << ((uint32_t)1L);

puts 0xfffe into x, as opposed to 0x1fffe as I would have expected. Is a C compiler not required to promote such that both operands of a shift are the same size?


John Regehr

reply via email to

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