On Fri, Jul 06, 2007 at 06:06:43AM -0600, Wachdorf, Daniel R wrote:
>     val = (1 << 31);

Try 1UL << 31 instead.

> Should the result be 0x80000000?  I understand that the bit shift is a
> 32 bit operation, but shouldn't the compiler then up convert that to a
> 64 bit unsigned long?

No, a signed 32-bit integer is always sign extended when promoted to
64-bit.  If you have C99 handy, see section 6.3.1.3 (Signed and
unsigned integers).

-- 
Daniel Jacobowitz
CodeSourcery

Reply via email to