Add ARM vmull implementation for CRC32.

This commit is contained in:
2021-10-11 22:59:48 +01:00
parent 0c82064750
commit 835c49dc76
2 changed files with 423 additions and 1 deletions

View File

@@ -35,9 +35,9 @@ using System.IO;
using System.Runtime.Intrinsics.Arm;
using System.Runtime.Intrinsics.X86;
using System.Text;
using Aaru6.Checksums.CRC32;
using Aaru.CommonTypes.Interfaces;
using Aaru.Helpers;
using Aaru6.Checksums.CRC32;
namespace Aaru6.Checksums
{
@@ -449,6 +449,23 @@ namespace Aaru6.Checksums
return;
}
if(AdvSimd.IsSupported)
{
// Only works in blocks of 16 bytes
uint blocks = len / 64;
if(blocks > 0)
{
previousCrc = ~Vmull.Step(data, blocks * 64, ~previousCrc);
currentPos = (int)(blocks * 64);
len -= blocks * 64;
}
if(len == 0)
return;
}
}
// Unroll according to Intel slicing by uint8_t