mirror of
https://github.com/SabreTools/SabreTools.Hashing.git
synced 2026-09-23 15:24:51 +00:00
Less hardcoding, I guess?
This commit is contained in:
@@ -106,9 +106,9 @@ namespace SabreTools.Hashing.Crc
|
||||
for (int b = 0; b < 8; b++)
|
||||
{
|
||||
if (_definition.ReflectIn)
|
||||
hash = (hash >> 1) ^ OptTable[0, (byte)(hash & 1) ^ ((byte)(data[offset] >> b) & 1)];
|
||||
hash = (hash >> _processBits) ^ OptTable[0, (byte)(hash & 1) ^ ((byte)(data[offset] >> b) & 1)];
|
||||
else
|
||||
hash = (hash << 1) ^ OptTable[0, (byte)((hash >> _bitShift) & 1) ^ ((byte)(data[offset] >> (7 - b)) & 1)];
|
||||
hash = (hash << _processBits) ^ OptTable[0, (byte)((hash >> _bitShift) & 1) ^ ((byte)(data[offset] >> (7 - b)) & 1)];
|
||||
}
|
||||
}
|
||||
|
||||
@@ -116,9 +116,9 @@ namespace SabreTools.Hashing.Crc
|
||||
else
|
||||
{
|
||||
if (_definition.ReflectIn)
|
||||
hash = (hash >> 8) ^ OptTable[0, (byte)hash ^ data[offset]];
|
||||
hash = (hash >> _processBits) ^ OptTable[0, (byte)hash ^ data[offset]];
|
||||
else
|
||||
hash = (hash << 8) ^ OptTable[0, ((byte)(hash >> _bitShift)) ^ data[offset]];
|
||||
hash = (hash << _processBits) ^ OptTable[0, ((byte)(hash >> _bitShift)) ^ data[offset]];
|
||||
}
|
||||
}
|
||||
}
|
||||
|
||||
Reference in New Issue
Block a user