private static ComputeCRC16Checksum ( byte buffer, long len ) : ushort | ||
buffer | byte | |
len | long | |
return | ushort |
private static ushort ComputeCRC16Checksum(byte[] buffer, long len)
{
if (buffer == null) throw new ArgumentNullException();
ushort crc = 0;
for (int i = 0; i < len; ++i)
{
crc = (ushort)((crc >> 8) ^ table[(crc ^ buffer[i]) & 0xff]);
}
return crc;
}