Find centralized, trusted content and collaborate around the technologies you use most.
Teams
Q&A for work
Connect and share knowledge within a single location that is structured and easy to search.
我想计算这个:tab<<1使用 tab 一个字节数组
tab<<1
我做了这几行,但似乎不起作用。我做错了什么?
byte[] T = new byte[16]; for (int i = 0; i < 16; i++) T[i] = (byte)(tab[i] << 1);
如果你想结转MSB每个字节,你可以这样做:
MSB
var t = new byte[16]; byte carry = 0x0; for (var i = 15; i >=0 ; i--) { var newcarry = (byte) (t[i] & 0x80); t[i] = (byte) (t[i] << 1 + carry); carry = newcarry; }