原封不动的抄下来就行了......
static readonly ushort[] crctab16 = new ushort[] {
//复制粘贴
};
ushort GetCrc16(byte[] data, int offset, int length) {
ushort fcs = 0xffff;
while (length>0) {
fcs = (ushort)((fcs>>8)^crcab16[(fcs^pdata[offset+offset]) & 0xff]);
length--;
offset++;
}
return (ushort)(~fcs);
}