js编程中位操作bit32位操作,编译器有bug?
1、如下代码,编译有bug var test_param = 0 test_param |= 0x80000000; console.log('0x' + test_param.toString(16)) 打印结果:[图片],多了一个负号,莫非自动解释成有符号的类型了? 2、如下代码,编译才正确 var test_param = 0 test_param = 0x80000000; console.log('0x' + test_param.toString(16)) 打印结果:[图片] 3、但问题又来了,如果是if()中的bit32位判断,也又bug var test_param = 0 test_param = 0x80000000; console.log('0x' + test_param.toString(16)) if(test_param&(0x80000000)>0) { console.log('test_param的bit32=1') } else { console.log('test_param的bit32=0') } 得出结果居然bit32=0[图片]要怎么才争取呢,if内需要这么写:if(test_param&(0x80000000))才对