在告诉我谷歌之前,请注意Google不会搜索“< <”字符。<<做什么?
我发现以下内容:
data是一个字节数组。
INT ResultChannel =数据[1] +(数据[2] < < 8)
如何进行< <工作?
在告诉我谷歌之前,请注意Google不会搜索“< <”字符。<<做什么?
我发现以下内容:
data是一个字节数组。
INT ResultChannel =数据[1] +(数据[2] < < 8)
如何进行< <工作?
左移操作(< <)移位由 数由它的第二操作数指定的位的左其第一个操作数。第二个 操作数的类型必须是一个int或具有预定义的隐式 数字转换为int的类型。
static void Main()
{
int i = 1;
long lg = 1;
// Shift i one bit to the left. The result is 2.
Console.WriteLine("0x{0:x}", i << 1);
// In binary, 33 is 100001. Because the value of the five low-order
// bits is 1, the result of the shift is again 2.
Console.WriteLine("0x{0:x}", i << 33);
// Because the type of lg is long, the shift is the value of the six
// low-order bits. In this example, the shift is 33, and the value of
// lg is shifted 33 bits to the left.
// In binary: 10 0000 0000 0000 0000 0000 0000 0000 0000
// In hexadecimal: 2 0 0 0 0 0 0 0 0
Console.WriteLine("0x{0:x}", lg << 33);
}
它是一个位移运算符。
它将位移动到左边。
例如:5 < < 3返回值为5的三位置于左侧。五二进制是:
00000101
如果你移动你得到三个地方向左:
00101000
这是40
其实,[http://msdn.microsoft。 com/en-us/library/a1sway8w.aspx](http://msdn.microsoft.com/en-us/library/a1sway8w.aspx) – 2013-03-03 14:03:08
你甚至试过谷歌? – antonijn 2013-03-03 14:04:32
你有没有试过google <<字符?告诉我,如果你有它的运气... – user970696 2013-03-03 14:05:00