solve edge case

This commit is contained in:
dennisarfan 2025-08-01 09:51:39 +07:00
parent 741d34a5e0
commit 0472bfe58e
15 changed files with 685 additions and 47 deletions

View file

@ -15,6 +15,17 @@ public static class Crc32
return ~crc;
}
public static uint Compute(Stream stream, int count, uint initial = 0xFFFFFFFF)
{
uint crc = initial;
while (count-- > 0)
{
crc = Table[(crc ^ stream.ReadByte()) & 0xFF] ^ (crc >> 8);
}
return ~crc;
}
private static uint[] GenerateTable()
{
const uint poly = 0xEDB88320;