Afiefh
Afiefh

Reputation: 1067

Implementing CRC16 efficiently

I got a program that I know will run only on very specific hardware, so I started using crc32 as supplied by the SSE4.2 instruction set, but now I need crc16 for a different purpose. Is there a way to coax the hardware to give me crc16 with the same performance as SSE's crc32?

Thanks

Upvotes: 1

Views: 875

Answers (1)

Mark Adler
Mark Adler

Reputation: 112209

If you have the PCLMULQDQ instruction, you can use that to make a fast CRC. Though not quite as fast as the crc32 instruction.

Alternatively, a poor man's check value could be the low 16 bits of the result of crc32.

Upvotes: 1

Related Questions