码:
@L_301_0@
(摘自维基百科的“外部链接”)
http://en.wikipedia.org/wiki/Cyclic_redundancy_check
这是代码的方法示例:
voID CCRC32::PartialCRC(unsigned long *ulCRC,const unsigned char *sData,unsigned long ulDataLength) {while(ulDataLength--) { //If your compiler complains about the following line,try changing each //occurrence of *ulCRC with "((unsigned long)*ulCRC)" or "*(unsigned long *)ulCRC". *(unsigned long *)ulCRC = ((*(unsigned long *)ulCRC) >> 8) ^ this->ultable[((*(unsigned long *)ulCRC) & 0xFF) ^ *sData++];}unsigned long CCRC32::FullCRC(const unsigned char *sData,unsigned long ulDataLength) { unsigned long ulCRC = 0xffffffff; //Initilaize the CRC. this->PartialCRC(&ulCRC,sData,ulDataLength); return(ulCRC ^ 0xffffffff); //Finalize the CRC and return.}
所以我的问题是:你们中的任何一位大端大师都知道如何调整上述方法来处理大端机器,或者有没有人知道可以实现我的目标的现有源代码?到目前为止,我的搜索都没有成功.
感谢您的时间,
詹姆士
解决方法 不确定它是否有帮助,但 this piece of C code有大小版本. 总结以上是内存溢出为你收集整理的c – 这个CRC32方法的大端兼容版本会是什么样的?全部内容,希望文章能够帮你解决c – 这个CRC32方法的大端兼容版本会是什么样的?所遇到的程序开发问题。
如果觉得内存溢出网站内容还不错,欢迎将内存溢出网站推荐给程序员好友。
欢迎分享,转载请注明来源:内存溢出
评论列表(0条)