2

I found a operator Ive never see before in this code

d[(a + 64 >>> 9 << 4) + 14] = a;

I know the << operator is left shift. But really confuse >>>.

Can you help me explain this?

Chweng Mega
  • 1,598
  • 1
  • 13
  • 22
  • 6
    [Zero-fill right shift](https://developer.mozilla.org/en/docs/Web/JavaScript/Reference/Operators/Bitwise_Operators#Unsigned_right_shift) – Alex K. Aug 22 '17 at 11:33
  • 1
    Possible duplicate of [What is the difference between operator >>> in Java and JavaScript?](https://stackoverflow.com/questions/40994783/what-is-the-difference-between-operator-in-java-and-javascript) – Junaid Aug 22 '17 at 11:33
  • Zero fill right shift Shifts right by pushing zeros in from the left, and let the rightmost bits fall off – l.g.karolos Aug 22 '17 at 11:35
  • 2
    Possible duplicate of [What is the JavaScript >>> operator and how do you use it?](https://stackoverflow.com/questions/1822350/what-is-the-javascript-operator-and-how-do-you-use-it) – Roman Aug 22 '17 at 11:35
  • https://www.w3schools.com/js/js_operators.asp – Sinto Aug 22 '17 at 11:37

1 Answers1

5

Zero fill right shift

Shifts right by pushing zeros in from the left, and let the rightmost bits fall off

Operation   Result     Same as      Result
5 >>> 1        2       0101 >>> 1    0010
l.g.karolos
  • 1,131
  • 1
  • 10
  • 25