WORD(BYTE(pBuf[nPos]));
这句话什么什么意思?
WORD CRC16_LH(unsigned char* pBuf,int nLength){ WORD nCRC = 0x0000; WORD ch; WORD tmp; int nIndex; int nPos=0; while(nLength>0) { nLength -= 1; ch = WORD(BYTE(pBuf[nPos])); nPos += 1; for(nIndex = 0;nIndex<=7;nIndex++) { tmp = nCRC & 0x8000; nCRC <<= 1; if(ch & 0x80) nCRC += 1; if(tmp) nCRC = nCRC ^ 0x1021; ch <<= 1; } } return nCRC;} typedef unsigned short WORD;typedef unsigned char BYTE;
[解决办法]
WORD(BYTE(pBuf[nPos]));
强制转换
[解决办法]