Edit: This question is out of date as the Polyfill example has been updated. I\'m leaving the question here just for reference. Read the correct answer for usef
The ECMAScript specification states that the value is converted to UInt32 in step 5 and 8 of http://www.ecma-international.org/ecma-262/5.1/#sec-11.7:
11.7.3 The Unsigned Right Shift Operator ( >>> )
Performs a zero-filling bitwise right shift operation on the left operand by the amount > specified by the right operand.
The production
ShiftExpression : ShiftExpression >>> AdditiveExpression
is evaluated as follows:
- Let
lref
be the result of evaluatingShiftExpression
.- Let
lval
beGetValue(lref)
.- Let
rref
be the result of evaluatingAdditiveExpression
.- Let
rval
beGetValue(rref)
.- Let
lnum
beToUint32(lval)
.- Let
rnum
beToUint32(rval)
.- Let
shiftCount
be the result of masking out all but the least significant 5 bits ofrnum
, that is, computernum & 0x1F
.- Return the result of performing a zero-filling right shift of
lnum
byshiftCount
bits. Vacated bits are filled with zero. The result is an unsigned 32-bit integer.