General code cleanup and style refactor.

This commit is contained in:
2022-11-15 15:58:41 +00:00
parent b5f8686256
commit 40487268b4
6 changed files with 41 additions and 40 deletions

View File

@@ -43,33 +43,33 @@
<NrtShowRevision>true</NrtShowRevision>
</PropertyGroup>
<ItemGroup>
<Compile Include="Adler32\neon.cs" />
<Compile Include="Adler32\ssse3.cs" />
<Compile Include="CRC16CCITTContext.cs" />
<Compile Include="CRC16IBMContext.cs" />
<Compile Include="CRC32\arm_simd.cs" />
<Compile Include="CRC32\clmul.cs" />
<Compile Include="CRC64\clmul.cs" />
<Compile Include="Native.cs" />
<Compile Include="Register.cs" />
<Compile Include="SpamSumContext.cs" />
<Compile Include="Adler32Context.cs" />
<Compile Include="CDChecksums.cs" />
<Compile Include="CRC16Context.cs" />
<Compile Include="CRC32Context.cs" />
<Compile Include="CRC64Context.cs" />
<Compile Include="FletcherContext.cs" />
<Compile Include="MD5Context.cs" />
<Compile Include="ReedSolomon.cs" />
<Compile Include="SHA1Context.cs" />
<Compile Include="SHA256Context.cs" />
<Compile Include="SHA384Context.cs" />
<Compile Include="SHA512Context.cs" />
<Compile Include="Adler32\neon.cs"/>
<Compile Include="Adler32\ssse3.cs"/>
<Compile Include="CRC16CCITTContext.cs"/>
<Compile Include="CRC16IBMContext.cs"/>
<Compile Include="CRC32\arm_simd.cs"/>
<Compile Include="CRC32\clmul.cs"/>
<Compile Include="CRC64\clmul.cs"/>
<Compile Include="Native.cs"/>
<Compile Include="Register.cs"/>
<Compile Include="SpamSumContext.cs"/>
<Compile Include="Adler32Context.cs"/>
<Compile Include="CDChecksums.cs"/>
<Compile Include="CRC16Context.cs"/>
<Compile Include="CRC32Context.cs"/>
<Compile Include="CRC64Context.cs"/>
<Compile Include="FletcherContext.cs"/>
<Compile Include="MD5Context.cs"/>
<Compile Include="ReedSolomon.cs"/>
<Compile Include="SHA1Context.cs"/>
<Compile Include="SHA256Context.cs"/>
<Compile Include="SHA384Context.cs"/>
<Compile Include="SHA512Context.cs"/>
</ItemGroup>
<ItemGroup>
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj" />
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj" />
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj" />
<ProjectReference Include="..\Aaru.CommonTypes\Aaru.CommonTypes.csproj"/>
<ProjectReference Include="..\Aaru.Helpers\Aaru.Helpers.csproj"/>
<ProjectReference Include="..\Aaru.Console\Aaru.Console.csproj"/>
</ItemGroup>
<ItemGroup>
<EmbeddedResource Include="..\LICENSE.LGPL">
@@ -80,7 +80,7 @@
</EmbeddedResource>
</ItemGroup>
<ItemGroup>
<PackageReference Include="Aaru.Checksums.Native" Version="6.0.0-alpha6" />
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all" />
<PackageReference Include="Aaru.Checksums.Native" Version="6.0.0-alpha6"/>
<PackageReference Include="Unclassified.NetRevisionTask" Version="0.4.3" PrivateAssets="all"/>
</ItemGroup>
</Project>

View File

@@ -136,10 +136,10 @@ static class Ssse3
*/
vS1 = Sse2.Add(vS1, Sse2.Shuffle(vS1, 177));
vS1 = Sse2.Add(vS1, Sse2.Shuffle(vS1, 78));
s1 += (uint)Sse2.ConvertToInt32(vS1.AsInt32());
s1 += (uint)Sse2.ConvertToInt32(vS1.AsInt32());
vS2 = Sse2.Add(vS2, Sse2.Shuffle(vS2, 177));
vS2 = Sse2.Add(vS2, Sse2.Shuffle(vS2, 78));
s2 = (uint)Sse2.ConvertToInt32(vS2.AsInt32());
s2 = (uint)Sse2.ConvertToInt32(vS2.AsInt32());
/*
* Reduce.
*/

View File

@@ -216,8 +216,8 @@ public class Crc16Context : IChecksum
// http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf
// http://sourceforge.net/projects/slicing-by-8/
var currentPos = 0;
const int unroll = 4;
var currentPos = 0;
const int unroll = 4;
const int bytesAtOnce = 8 * unroll;
ushort crc = previousCrc;
@@ -254,8 +254,8 @@ public class Crc16Context : IChecksum
// http://www.intel.com/technology/comms/perfnet/download/CRC_generators.pdf
// http://sourceforge.net/projects/slicing-by-8/
var currentPos = 0;
const int unroll = 4;
var currentPos = 0;
const int unroll = 4;
const int bytesAtOnce = 8 * unroll;
ushort crc = previousCrc;

View File

@@ -121,17 +121,20 @@ static class Clmul
while((len -= 64) >= 0)
{
var xmmT0 = Vector128.Create(BitConverter.ToUInt32(src, bufPos), BitConverter.ToUInt32(src, bufPos + 4),
BitConverter.ToUInt32(src, bufPos + 8), BitConverter.ToUInt32(src, bufPos + 12));
BitConverter.ToUInt32(src, bufPos + 8),
BitConverter.ToUInt32(src, bufPos + 12));
bufPos += 16;
var xmmT1 = Vector128.Create(BitConverter.ToUInt32(src, bufPos), BitConverter.ToUInt32(src, bufPos + 4),
BitConverter.ToUInt32(src, bufPos + 8), BitConverter.ToUInt32(src, bufPos + 12));
BitConverter.ToUInt32(src, bufPos + 8),
BitConverter.ToUInt32(src, bufPos + 12));
bufPos += 16;
var xmmT2 = Vector128.Create(BitConverter.ToUInt32(src, bufPos), BitConverter.ToUInt32(src, bufPos + 4),
BitConverter.ToUInt32(src, bufPos + 8), BitConverter.ToUInt32(src, bufPos + 12));
BitConverter.ToUInt32(src, bufPos + 8),
BitConverter.ToUInt32(src, bufPos + 12));
bufPos += 16;

View File

@@ -34,9 +34,7 @@ namespace Aaru.Checksums;
using System.Runtime.InteropServices;
/// <summary>
/// Handles native implementations of compression algorithms
/// </summary>
/// <summary>Handles native implementations of compression algorithms</summary>
public static class Native
{
static bool _checked;

View File

@@ -78,7 +78,7 @@ public class ReedSolomon
bool _initialized;
int _mm, _kk, _nn;
/// <summary>
/// Primitive polynomials - see Lin & Costello, Error Control Coding Appendix A, and Lee & Messerschmitt, Digital
/// Primitive polynomials - see Lin & Costello, Error Control Coding Appendix A, and Lee & Messerschmitt, Digital
/// Communication p. 453.
/// </summary>
int[] _pp;