C6297

warning C6297: Arithmetic overflow: 32-bit value is shifted, then cast to 64-bit value. Result may not be an expected value

This warning indicates incorrect behavior that results from integral promotion rules and types larger than those in which arithmetic is typically performed.

In this case, a 32-bit value was shifted left, and the result of that shift was cast to a 64-bit value. If the shift overflowed the 32-bit value, bits are lost.

If you do not want to lose bits, cast the value to be shifted to a 64-bit quantity before it is shifted. If you want to lose bits, performing the appropriate cast to unsigned long or a short type, or masking the result of the shift will eliminate this warning and make the intent of the code more clear.