Ask HN: Why isn't unsigned right shift the default in JavaScript?
Consider the following:
0xFFFFFFFF >> 0 === -1
0xFFFFFFFF >>> 0 === 4294967295
1 << 31 === -2147483648
1 << 31 >> 1 === -1073741824
1 << 31 >>> 1 === 1073741824
Generally, I'd think unsigned is the more typical use case and signed is less used here... am I wrong?If that's true, why isn't >>> the "cast to signed 32-bit and shift" version and >> the "cast to unsigned 32-bit and shift" version?
0 comments
[ 3.7 ms ] story [ 14.1 ms ] threadNo comments yet.