摘要:
unsigned short checksum(unsigned short* usBuf, unsigned int nSize){unsigned long usChksum=0;//Calculate the checksumwhile (nSize>1){usChksum+=*usBuf++;nSize-=sizeof(unsigned short);}//If we have one char leftif (nSize)usChksum+=*(unsigned char*)usBuf;//Complete the calculationsusChksum=(usChksum 阅读全文