|Property/method value type:||Number primitive|
|Argument list:||anOperand1||A value to be shifted and assigned to|
|anOperand2||A distance to shift anOperand1|
Bitwise shift rightwards the left operand by the number of bits in the right operand and assign the result to the left operand.
This is functionally equivalent to the expression:
anOperand1 = anOperand1 >> anOperand2;
The bitwise shift right operator converts its left operand to a 32 bit integer and moves it rightwards by the number of bits indicated by the right operand.
As the value is shifted rightwards, bits that roll out of the right end of the register are discarded. The left-hand end of the register containing the sign bit is duplicated to sign fill the value as it shifts. Shifting rightwards by 32 bits will fill the register with all zero or all one bits according to the value of the sign bit at the outset.
Because the value is converted to an integer, any fractional part is discarded as the shift begins.
The right hand operand is converted to a 5-bit value with a bitwise mask to limit the distance of the shift to 32 bits. This can cause unexpected results if the right-hand side is derived from an expression that may yield a value larger than 32.
Although this is classified as an assignment operator it is really a compound of an assignment and a bitwise operator.
The associativity is right to left.
Refer to the Operator Precedence topic for details of execution order.
The new value of anOperand1 is returned as a result of the expression.
The operand to the left of the operator must be an LValue. That is, it should be able to take an assignment and store the value.
|See also:||Assignment operator, Associativity, Bit-field, Bitwise operator, Bitwise shift left (<<), Bitwise shift left then assign (<<=), Bitwise shift operator, Bitwise shift right (>>), Bitwise unsigned shift right (>>>), Bitwise unsigned shift right and assign (>>>=), LValue, Operator Precedence, Shift operator|