mirror of
https://github.com/aaru-dps/AaruBenchmark.git
synced 2025-12-16 19:24:36 +00:00
Add SSSE3 implementation of Adler32.
This commit is contained in:
@@ -31,9 +31,11 @@
|
||||
// ****************************************************************************/
|
||||
|
||||
using System.IO;
|
||||
using System.Runtime.Intrinsics.X86;
|
||||
using System.Text;
|
||||
using Aaru.CommonTypes.Interfaces;
|
||||
using Aaru.Helpers;
|
||||
using Aaru6.Checksums.Adler32;
|
||||
|
||||
namespace Aaru6.Checksums
|
||||
{
|
||||
@@ -41,9 +43,9 @@ namespace Aaru6.Checksums
|
||||
/// <summary>Implements the Adler-32 algorithm</summary>
|
||||
public sealed class Adler32Context : IChecksum
|
||||
{
|
||||
const ushort ADLER_MODULE = 65521;
|
||||
const uint NMAX = 5552;
|
||||
ushort _sum1, _sum2;
|
||||
internal const ushort ADLER_MODULE = 65521;
|
||||
internal const uint NMAX = 5552;
|
||||
ushort _sum1, _sum2;
|
||||
|
||||
/// <summary>Initializes the Adler-32 sums</summary>
|
||||
public Adler32Context()
|
||||
@@ -87,6 +89,13 @@ namespace Aaru6.Checksums
|
||||
|
||||
static void Step(ref ushort preSum1, ref ushort preSum2, byte[] data, uint len)
|
||||
{
|
||||
if(Ssse3.IsSupported)
|
||||
{
|
||||
ssse3.Step(ref preSum1, ref preSum2, data, len);
|
||||
|
||||
return;
|
||||
}
|
||||
|
||||
uint sum1 = preSum1;
|
||||
uint sum2 = preSum2;
|
||||
uint n;
|
||||
|
||||
Reference in New Issue
Block a user