c - 计算大型 CRC32 的正确方法是什么

标签 c x86-64 sse crc32

Here这篇文章描述了如何使用现代 x86-64 处理器中的内置 CRC32 指令计算最大 1024 字节的 CRC32。但是,我需要计算超过1024字节的CRC32。计算每个 1024 字节 block 的 CRC32 并最后将它们相加是正确的方法,还是不正确?如果可以,正确的做法是什么?

最佳答案

引自intel white paper你的文章提到,

Instead of computing CRC of the entire message with a traditional linear method, we use a faster method to split an arbitrary length buffer to a number of smaller fixed size segments, compute the CRC on these segments in parallel followed by a recombination step of computing the effective CRC using the partial CRCs of the segments.

此外,

The final recombination of CRCs adds an overhead and can be implemented with lookup tables on the Nehalem microarchitecture – we show how to do this with as few tables as possible while giving excellent overall performance on the range of sizes. The PCLMULQDQ instruction in the Westmere microarchitecture allows efficient recombination of CRCs without lookup tables. The various methods are thoroughly explained in this paper with real code examples.

所以你需要详细研究这篇论文: 使用 CRC32 指令对 iSCSI 多项式进行快速 CRC 计算

关于c - 计算大型 CRC32 的正确方法是什么,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/10333889/

相关文章:

c - C 是否标准化了链接器符号命名?

math - Bullet Physics 四元数 sse 实现疑惑

c++ - 我的 LookAt 的 SSE 实现不起作用

c - 动态打开和关闭 flex token

assembly - 英特尔 x86-64 XSAVE/XRSTOR

x86-64 - 在 Intel x86-64 架构上是否以 little endian 4 字节字获取机器代码指令?

assembly - 比较 xmm 中的四字

c - 管理通信协议(protocol)本地套接字c

c - 未定义对 "tpl_map"的引用

c - 如何抑制 “warning: cast to pointer from integer of different size”?