Using SSE 4.2 crc32 algorithm in C #? Is it possible?

I need to calculate crc32 on a large number of files, as well as huge files (several GB). I tried several algos found on the Internet, for example Damieng or this one , and it works, but it is slow (more than 1 min). I found this test on various crc32 algorithms and found that sse 4.2 has a hardware accelerated crc32 method.

I did not find sample C # code to use crc32 SSE code.

1 - Is it possible?

2 - How to determine if the current processor supports SSE4.2? (to switch the crc32 method)

(please attach sample code if possible)

+4
source share
1 answer

I believe Mono allows access to CPU instructions through the Mono.Simd namespace:

http://tirania.org/blog/archive/2008/Nov-03.html

Stackoverflow related question:

Is using SSE in C # possible?

Mono code is open source. It looks like you can't just add this to your .NET project to get the benefit, although it seems to require Mono runtime:

Calling mono C # code from Microsoft.net?

However, this will work, but the software will be emulated.

+1
source

All Articles