mirror of
https://github.com/claunia/cuetools.net.git
synced 2025-12-16 18:14:25 +00:00
Calculating CRC32 with offsets and fast
This commit is contained in:
@@ -86,6 +86,14 @@ namespace CUETools.TestCodecs
|
||||
Crc32 crc32 = new Crc32();
|
||||
uint crc1 = crc32.ComputeChecksum(0xffffffff, buff.Bytes, 0, buff.ByteLength) ^ 0xffffffff;
|
||||
Assert.AreEqual<uint>(3856971150, crc1, "CRC32 was not set correctly.");
|
||||
|
||||
uint crc2 = crc32.ComputeChecksum(0, buff.Bytes, 0, buff.ByteLength);
|
||||
uint crc3 = crc32.ComputeChecksum(0, buff.Bytes, 0, 7);
|
||||
uint crc4 = crc32.ComputeChecksum(0, buff.Bytes, 7, buff.ByteLength - 7);
|
||||
uint crc5 = crc32.Combine(crc3, crc4, buff.ByteLength - 7);
|
||||
Assert.AreEqual<uint>(crc2, crc5, "CRC32 was not combined correctly.");
|
||||
uint crc6 = crc2 ^ crc32.Combine(crc3, 0, buff.ByteLength - 7);
|
||||
Assert.AreEqual<uint>(crc4, crc6, "CRC32 was not substracted correctly.");
|
||||
Assert.AreEqual<uint>(3856971150, target.CRC32(0), "CRC32 was not set correctly.");
|
||||
Assert.AreEqual<uint>(1921661108, target.CRCWONULL(0), "CRC32WONULL was not set correctly.");
|
||||
}
|
||||
|
||||
@@ -3,7 +3,7 @@
|
||||
<PropertyGroup>
|
||||
<Configuration Condition=" '$(Configuration)' == '' ">Debug</Configuration>
|
||||
<Platform Condition=" '$(Platform)' == '' ">AnyCPU</Platform>
|
||||
<ProductVersion>8.0.50727</ProductVersion>
|
||||
<ProductVersion>9.0.30729</ProductVersion>
|
||||
<SchemaVersion>2.0</SchemaVersion>
|
||||
<ProjectGuid>{04945FB2-8410-4F14-8262-2ED18DCDACD6}</ProjectGuid>
|
||||
<OutputType>Library</OutputType>
|
||||
@@ -26,9 +26,9 @@
|
||||
</PropertyGroup>
|
||||
<PropertyGroup Condition=" '$(Configuration)|$(Platform)' == 'Release|AnyCPU' ">
|
||||
<DebugSymbols>false</DebugSymbols>
|
||||
<Optimize>true</Optimize>
|
||||
<Optimize>false</Optimize>
|
||||
<OutputPath>..\bin\Release\</OutputPath>
|
||||
<DefineConstants>TRACE</DefineConstants>
|
||||
<DefineConstants>DEBUG;TRACE</DefineConstants>
|
||||
</PropertyGroup>
|
||||
<ItemGroup>
|
||||
<Reference Include="Microsoft.VisualStudio.QualityTools.UnitTestFramework, Version=9.0.0.0, Culture=neutral, PublicKeyToken=b03f5f7f11d50a3a, processorArchitecture=MSIL" />
|
||||
|
||||
Reference in New Issue
Block a user