EasyManua.ls Logo

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE - Bitwise Unsigned Right Shift Operator

MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE
780 pages
Print Icon
To Next Page IconTo Next Page
To Next Page IconTo Next Page
To Previous Page IconTo Previous Page
To Previous Page IconTo Previous Page
Loading...
134 ActionScript language elements
string result = (lsb ? "1" : "0")+result;
// Shift numberToConvert right by one bit, to see next bit
numberToConvert >>= 1;
}
return result;
}
trace(convertToBinary(479));
// Returns the string 00000000000000000000000111011111
// This string is the binary representation of the decimal
// number 479
See also
>> bitwise right shift operator
>>> bitwise unsigned right shift operator
expression1 >>> expression2
The same as the bitwise right shift (>>) operator except that it does not preserve the sign of the
original
expression because the bits on the left are always filled with 0.
Floating-point numbers are converted to integers by discarding any digits after the decimal
point. Positive integers are converted to an unsigned hex value with a maximum value of
4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant
digits discarded when they are converted so the value is still 32-bit. Negative numbers are
converted to an unsigned hex value via the two's complement notation, with the minimum
being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's
complement with greater precision and also have the most significant digits discarded.
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression1 : Number - A number or expression to be shifted right.
expression2 : Number - A number or expression that converts to an integer between 0
and 31.
Returns
Number - The result of the bitwise operation.
Example
The following example converts -1 to a 32-bit integer and shifts it 1 bit to the right:
var x:Number = -1 >>> 1;
trace(x); // output: 2147483647

Table of Contents

Related product manuals