Bit-shifting long values

Left-bit-shifting long values will produce different results in 32-bit and 64-bit modes. The examples in the table below show the effects of performing a bit-shift on long constants, using the following code segment:

long l=valueL<<1;
Table 5. Results of bit-shifting long values
Initial value Symbolic constant Value after bit shift
32-bit mode 64-bit mode
0x7FFFFFFFL INT_MAX 0xFFFFFFFE 0x00000000FFFFFFFE
0x80000000L INT_MIN 0x00000000 0x0000000100000000
0xFFFFFFFFL UINT_MAX 0xFFFFFFFE 0x1FFFFFFFE