Symbols > >>= (bitwise right shift and assignment) |
>>= (bitwise right shift and assignment)
bitwise right 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.
Returns
Nothing.
Description
Operator (bitwise compound assignment); this operator performs a bitwise right-shift operation and stores the contents as a result in expression1.
Example
The following two expressions are equivalent.
A >>= BA = (A >> B)
The following commented code uses the bitwise (>>=) operator . It is also an example of using all bitwise operators.
function convertToBinary(number){var result = "";for (var i=0; i<32; i++) {// Extract least significant bit using bitwise ANDvar lsb = number & 1;// Add this bit to our result stringresult = (lsb ? "1" : "0") + result;// Shift number right by one bit, to see next bitnumber >>= 1;}return result;}trace(convertToBinary(479));// Returns the string 00000000000000000000000111011111// The above string is the binary representation of the decimal// number 479
See also