joyent/node — Issue #2798: right shift operation bug in v0.6.10
Author: ifElser
Created: 2012-02-21 11:30:18+00:00
State: open

> a
65195
> a.toString(2)
'1111111010101011'
> (a & 0x8000 >> 7).toString(2)
'0'
> (a & 0x8000).toString(2)
'1000000000000000'
> (a & 0x8000 >> 1).toString(2)
'100000000000000'
> (a & 0x8000 >> 2).toString(2)
'10000000000000'
> (a & 0x8000 >> 3).toString(2)
'1000000000000'
> (a & 0x8000 >> 4).toString(2)
'100000000000'
> (a & 0x8000 >> 5).toString(2)
'10000000000'
> (a & 0x8000 >> 6).toString(2)
'1000000000'
> (a & 0x8000 >> 7).toString(2)
'0' // must be '100000000'
> (a & 0x8000 >> 8).toString(2)
'10000000'