Skip to content

Instantly share code, notes, and snippets.

@prof7bit
Created August 5, 2014 22:09
Show Gist options
  • Save prof7bit/7fc558626f94bd8a81b7 to your computer and use it in GitHub Desktop.
Save prof7bit/7fc558626f94bd8a81b7 to your computer and use it in GitHub Desktop.
crc16 in Pascal
procedure CRC16_Update(var CRC: Word; Data: Byte);
var
I: Integer;
begin
CRC := CRC xor (Word(Data));
for I := 0 to 7 do begin
if (CRC and 1) <> 0 then
CRC := (CRC shr 1) xor $A001
else
CRC := CRC shr 1;
end;
end;
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment