solve edge case
This commit is contained in:
parent
741d34a5e0
commit
0472bfe58e
15 changed files with 685 additions and 47 deletions
|
|
@ -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;
|
||||
|
|
|
|||
Loading…
Add table
Add a link
Reference in a new issue