{
uint32 nChecksum = 0;
uint16 nCurVal;
uint32 nByteCounter;
uint32 nNumBytesEven = nNumBytes & ~(sizeof(uint16) ‐ 1);
// for reasons of performance, this function is limited to
64Kb length.
// Since the GenCP standard recommends to have
packets <= 1Kb, this should not be a problem.
assert(nNumBytes < 65535);
for (nByteCounter = 0; nByteCounter < nNumBytesEven; nByteCounter += sizeof(uint16))
{
// pBuffer is interpreted as an array of big endian
16 bit values.
nCurVal = (((uint16) pBuffer[nByteCounter]) << 8) | ((uint16) pBuffer[nByteCounter + 1]);
nChecksum += (uint32) nCurVal;
}
if ((nNumBytes & (sizeof(uint16) ‐ 1)) != 0)
{
// special case: buffer length is odd number
nChecksum += (((uint32) pBuffer[nNumBytesEven]) << 8);
}
while ((nChecksum & 0x4F0000) != 0)
{
nChecksum = (nChecksum & 0x4F) + (nChecksum >> 16);
return(~((uint16) nChecksum));
}
E:\VC\Microsoft Visual Studio\MyProjects\1\2.cpp(1) : error C2146: syntax error : missing ';' before identifier 'GenCpChecksum16'
E:\VC\Microsoft Visual Studio\MyProjects\1\2.cpp(1) : error C2501: 'uint16' : missing storage-class or type specifiers
E:\VC\Microsoft Visual Studio\MyProjects\1\2.cpp(1) : fatal error C1004: unexpected end of file found
能不能解答一下怎么改程序,或者这个程序应该怎么看啊
编译器提示uint16这个类型名称不认识,缺少相应的头文件包含
然后函数少了最后的大括号