<<= (bitwise left shift and assignment) 255
<< (bitwise left shift)
Availability
Flash Player 5.
Usage
expression1
<< expression2
Parameters
expression1
A number or expression to be shifted left.
expression2 A number or expression that converts to an integer from 0 to 31.
Returns
Nothing.
Description
Operator (bitwise); converts expression1 and expression2 to 32-bit integers, and shifts all of
the bits in
expression1 to the left by the number of places specified by the integer resulting from
the conversion of
expression2. The bit positions that are emptied as a result of this operation are
filled in with 0. Shifting a value left by one position is the equivalent of multiplying it by 2.
Example
In the following example, the integer 1 is shifted 10 bits to the left.
x = 1 << 10
The result of this operation is x = 1024. This is because 1 decimal equals 1 binary, 1 binary
shifted left by 10 is 10000000000 binary, and 10000000000 binary is 1024 decimal.
In the following example, the integer 7 is shifted 8 bits to the left.
x = 7 << 8
The result of this operation is x = 1792. This is because 7 decimal equals 111 binary, 111 binary
shifted left by 8 bits is 11100000000 binary, and 11100000000 binary is 1792 decimal.
See also
>>= (bitwise right shift and assignment), >> (bitwise right shift), <<= (bitwise
left shift and assignment)
<<= (bitwise left shift and assignment)
Availability
Flash Player 5.
Usage
expression1 <<= expression2
Parameters
expression1
A number or expression to be shifted left.
expression2 A number or expression that converts to an integer from 0 to 31.