>> (bitwise right shift) 263
Description
Operator (comparison); compares two expressions and determines whether expression1 is
greater than or equal to
expression2 (true), or whether expression1 is less than expression2
(
false).
In Flash 5 or later, greater than or equal to (
>) is a comparison operator capable of handling
various data types. In Flash 4,
> is an numeric operator. Flash 4 files brought into the Flash 5 or
later authoring environment undergo a conversion process to maintain data type integrity.
>> (bitwise right shift)
Availability
Flash Player 5.
Usage
expression1 >> expression2
Parameters
expression1
A number or expression to be shifted right.
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 right by the number of places specified by the integer resulting
from the conversion of
expression2. Bits that are shifted to the right are discarded. To preserve
the sign of the original
expression, the bits on the left are filled in with 0 if the most significant
bit (the bit farthest to the left) of
expression1 is 0, and filled in with 1 if the most significant
bit is 1. Shifting a value right by one position is the equivalent of dividing by 2 and discarding
the remainder.
Example
The following example converts 65535 to a 32-bit integer, and shifts it 8 bits to the right.
x = 65535 >> 8
The result of the above operation is as follows:
x = 255
This is because 65535 decimal equals 1111111111111111 binary (sixteen 1’s),
1111111111111111 binary shifted right by 8 bits is 11111111 binary, and 11111111 binary is
255 decimal. The most significant bit is 0 because the integers are 32-bit, so the fill bit is 0.
The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right.
x = -1 >> 1
The result of the above operation is as follows:
x = -1