Bitwise Left Shift And Assignment Operator; Bitwise Not Operator - MACROMEDIA FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE Reference

Flash lite 2.x actionscript language reference
Hide thumbs Also See for FLASH 8-FLASH LITE 2.X ACTIONSCRIPT LANGUAGE:
Table of Contents

Advertisement

<<= bitwise left shift and assignment operator
expression1 <<= expression2
This operator performs a bitwise left shift (<<=) operation and stores the contents as a result
in
. The following two expressions are equivalent:
expression1
A <<= BA = (A << B)
Availability: ActionScript 1.0; Flash Lite 2.0
Operands
expression1 :
Number
expression2 :
Number
Returns
- The result of the bitwise operation.
Number
Example
In the following example, you use the bitwise left shift and assignment (<<=) operator to shift
all bits one space to the left:
var x:Number = 4;
// shift all bits one slot to the left.
x <<= 1;
trace(x); // output: 8
// 4 decimal = 0100 binary
// 8 decimal = 1000 binary
See also
<< bitwise left shift operator
,
operator
>> bitwise right shift operator

~ bitwise NOT operator

~expression
Also known as the one's complement operator or the bitwise complement operator. Converts
the
to a 32-bit signed integer, and then applies a bitwise one's complement. That
expression
is, every bit that is a 0 is set to 1 in the result, and every bit that is a 1 is set to 0 in the result.
The result is a signed 32-bit integer.
For example, the hex value 0x7777 is represented as this binary number: 0111011101110111
The bitwise negation of that hex value, ~0x7777, is this binary number: 1000100010001000
128
ActionScript language elements
- A number or expression to be shifted left.
- A number or expression that converts to an integer from 0 to 31.
,
>>= bitwise right shift and assignment

Advertisement

Table of Contents
loading

Table of Contents