October 2011
Beginner to intermediate
1200 pages
35h 33m
English
The left-shift operator has the following syntax:
value << shift
Here value is the integer value to be shifted, and shift is the number of bits to shift. For example, the following shifts all the bits in the value 13 three places to the left:
13 << 3
The vacated places are filled with zeros, and bits shifted past the end are discarded (see Figure E.1).
Figure E.1. The left-shift operator.

Because each bit position represents a value twice that of the bit to the right (see Appendix A, “Number Bases”), shifting one bit position is equivalent to multiplying the value by 2. Similarly, shifting two bit positions is equivalent to ...
Read now
Unlock full access