Javascript - Bitwise Unsigned Right Shift


The unsigned right shift operator is >>> and shifts all bits to the right.

For positive numbers, the effect is the same as a signed right shift.

var oldValue = 64;               //equal to binary 1000000 
var newValue = oldValue >>> 5;   //equal to binary 10 which is decimal 2 

For negative numbers, the empty bits get filled with zeros regardless of the sign of the number.

var oldValue = -64;              
var newValue = oldValue >>> 5;   //equal to decimal 134217726 

Related Topic