The software described in this documentation is either in Extended Support or Sustaining Support. See https://www.oracle.com/us/support/library/enterprise-linux-support-policies-069172.pdf for more information.
Oracle recommends that you upgrade the software described by this documentation as soon as possible.
When migrating from a 32-bit application to a 64-bit application, bit-shifting
operations can lead to errors. Untyped integral constants are assumed to be of type
unsigned int
. During shifting, this assumption can lead to unexpected
truncation. For example, the maximum possible value of i
in the following
code sample is 31 because the implicit type of 1
is unsigned
int
.
long j = 1 << i;
To allow the shift to work correctly on a 64-bit system, use 1L
instead of 1
:
long j = 1L << i;