我想知道:
如果代码显示为workSocket.dataBuffer[3]
,则它等于workSocket.dataBuffer[0x33]
,对吗?但是从enter link description here,33转换为51,因此workSocket.dataBuffer[0x33]
对应workSocket.dataBuffer[51]
?
下面的代码执行了很多| =比较和移位字节<&lt ;.这些比较的用途是什么?
如果我想将workSocket.m_Ch1
设为40,将workSocket.m_Ch2
设为40,那么输入workSocket.dataBuffer
应该是什么?
代码如下:
workSocket.UniqueNum = (uint) (((workSocket.dataBuffer[0xb9] << 8) | workSocket.dataBuffer[0xb8]) | -2147483648);
workSocket.Information = 0;
workSocket.Information |= (uint) ((workSocket.dataBuffer[0x1b] & 12) << 8);
workSocket.Information |= (uint) ((workSocket.dataBuffer[40] & 12) << 6);
workSocket.Information |= (uint) ((workSocket.dataBuffer[0x76] & 12) << 4);
workSocket.Information |= (uint) ((workSocket.dataBuffer[0x1b] & 3) << 4);
workSocket.Information |= (uint) ((workSocket.dataBuffer[40] & 3) << 2);
workSocket.Information |= (uint) (workSocket.dataBuffer[0x76] & 3);
workSocket.Information |= 0xc0000000;
num2 = (workSocket.dataBuffer[0x10] << 8) + workSocket.dataBuffer[15];
if (num2 > 10)
{
workSocket.m_Ch1 = ((float) (num2 + 190)) / 228f;
}
else
{
workSocket.m_Ch1 = 0f;
}
num2 = (workSocket.dataBuffer[0x1f] << 8) + workSocket.dataBuffer[30];
if (num2 > 10)
{
workSocket.m_Ch2 = ((float) (num2 + 0x99)) / 236f;
}
else
{
workSocket.m_Ch2 = 0f;
}