...
| Code Block | ||
|---|---|---|
| ||
int x = 50; x += (x << 2) + 1; |
This Though this is a legal manipulation that in two's-complement representation multiplies x by 5, then increments it by 1. Because the operation uses bit-shifting rather than multiplication, it performs faster on some processor types that do not have efficient integer multiplication datapaths.Unfortunately, the exact result of performing this shift depends on the underlying representation of the integer type. Thus the operation is implementation-defined. Additionally, it is challenging to immediately understand the effect of the second line of this code. The code is not self-documenting.
...