WORD(BYTE(pBuf[nPos]));
这句话什么什么意思?
- C/C++ code
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;} 我想把这代码转换成c语言的该怎么转?
[解决办法]
这不就是C语言的么,你要转什么啊,毛线
include windows.h直接能运行
[解决办法]
- C/C++ code
typedef unsigned short WORD;typedef unsigned char BYTE;
[解决办法]
WORD(BYTE(pBuf[nPos]));
强制转换
[解决办法]