I am aware that JS has >> apparently for signed-numbers shifts and >>> for unsigned.
I tested two simple examples in the node console:
a = 0b10000000000000000000000000000100
> a >> 31
-1
> a >>> 31
1
I've read mdn, w3schools, etc. But I expect both cases to be 1.
Also, see a 31 bit number:
a = 0b1000000000000000000000000000010;
a>>30
1
a>>>30
1
What is the mistake?
May be related to JS reading the number as 32Bits, and using that last bit as a sign?
> (a & a).toString(2)
'-1111111111111111111111111111100'