This is the mail archive of the
mailing list for the GCC project.
Re: X86_64 bit shifts
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 188.8.131.52 (Signed and