03.05.2013 Views

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

FLASH® LITE™ 2.x - Adobe Help and Support

SHOW MORE
SHOW LESS

Create successful ePaper yourself

Turn your PDF publications into a flip-book with our unique Google optimized e-Paper software.

var y:Number = 9;<br />

// 1111 |= 1001 = 1111<br />

trace(x |= y); // returns 15 decimal (1111 binary)<br />

See also<br />

& bitwise AND operator, &= bitwise AND assignment operator, ^ bitwise XOR<br />

operator, ^= bitwise XOR assignment operator, | bitwise OR operator, |=<br />

bitwise OR assignment operator, ~ bitwise NOT operator<br />

>> bitwise right shift operator<br />

expression1 >> expression2<br />

Converts expression1 <strong>and</strong> expression2 to 32-bit integers, <strong>and</strong> shifts all the bits in<br />

expression1 to the right by the number of places specified by the integer that results from<br />

the conversion of expression2 . Bits that are shifted off the right end are discarded. To<br />

preserve the sign of the original expression , the bits on the left are filled in with 0 if the<br />

most significant bit (the bit farthest to the left) of expression1 is 0, <strong>and</strong> filled in with 1 if the<br />

most significant bit is 1. Shifting a value right by one position is the equivalent of dividing by<br />

2 <strong>and</strong> discarding the remainder.<br />

Floating-point numbers are converted to integers by discarding any digits after the decimal<br />

point. Positive integers are converted to an unsigned hex value with a maximum value of<br />

4294967295 or 0xFFFFFFFF; values larger than the maximum have their most significant<br />

digits discarded when they are converted so the value is still 32-bit. Negative numbers are<br />

converted to an unsigned hex value via the two's complement notation, with the minimum<br />

being -2147483648 or 0x800000000; numbers less than the minimum are converted to two's<br />

complement with greater precision <strong>and</strong> also have the most significant digits discarded.<br />

The return value is interpreted as a two's complement number with sign, so the return value<br />

will be an integer in the range -2147483648 to 2147483647.<br />

Oper<strong>and</strong>s<br />

expression1 : Number - A number or expression to be shifted right.<br />

expression2 : Number - A number or expression that converts to an integer from 0 to 31.<br />

Returns<br />

Number - The result of the bitwise operation.<br />

Example<br />

The following example converts 65535 to a 32-bit integer <strong>and</strong> shifts it 8 bits to the right:<br />

Operators 123

Hooray! Your file is uploaded and ready to be published.

Saved successfully!

Ooh no, something went wrong!