Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
19
Task/CRC-32/XPL0/crc-32.xpl0
Normal file
19
Task/CRC-32/XPL0/crc-32.xpl0
Normal file
|
|
@ -0,0 +1,19 @@
|
|||
code HexOut=27; \intrinsic routine
|
||||
string 0; \use zero-terminated strings
|
||||
|
||||
func CRC32(Str, Len); \Return CRC-32 for given string
|
||||
char Str; int Len; \byte array, number of bytes
|
||||
int I, J, R, C;
|
||||
[R:= -1; \initialize with all 1's
|
||||
for J:= 0 to Len-1 do
|
||||
[C:= Str(J);
|
||||
for I:= 0 to 8-1 do \for each bit in byte...
|
||||
[if (R xor C) and 1 then R:= R>>1 xor $EDB88320
|
||||
else R:= R>>1;
|
||||
C:= C>>1;
|
||||
];
|
||||
];
|
||||
return not R;
|
||||
];
|
||||
|
||||
HexOut(0, CRC32("The quick brown fox jumps over the lazy dog", 43))
|
||||
Loading…
Add table
Add a link
Reference in a new issue