Interplane page as plain text, for reading tools and agents. English is the reference text: translate it with your own tool. Text in backticks and in ``` blocks (commands, fingerprints, file names) and link targets in <...> are exact: copy them, never translate them. Page: /drakestapleton/cortex/blob/main/tests/import/crctest.om # cortex aien-dev/cortex Brought by drakestapleton Sign in to star 0 stars 0 watching About Files History Releases Proposed changes Issues For developers branch `main` Branches Tags History `cortex / tests / import / crctest.om` 52 lines ยท 834 bytes Raw Blame History 1 note crctest: reads stdin (at most `8388608` bytes) into klw and prints CRC-32C as 8 lowercase hex 2 note digits plus LF. Also checks crc_klr over a copy in klr and the byte-wise streaming API agree. 3 text khexd "`0123456789abcdef`" 4 global kto uchar 16 5 fn main to int 6 n = ulong 0 7 while lt n len klw bound 999999 8 k = read 0 klw n sub len klw n 9 if lt k 0 10 ret 2 11 end 12 if eq k 0 13 break 14 end 15 n = add n ulong k 16 end 17 c = crc_klw 0 n 18 i = ulong 0 19 while lt i n bound 999999 20 for j ulong 16 21 if lt i n 22 put klr i get klw i 23 end 24 i = add i 1 25 end 26 end 27 if ne c crc_klr 0 n 28 ret 3 29 end 30 crc_reset 31 m = ulong 0 32 while lt m n bound 999999 33 for j ulong 16 34 if lt m n 35 crc_byte get klw m 36 end 37 m = add m 1 38 end 39 end 40 if ne c crc_value 41 ret 4 42 end 43 for h ulong 8 44 put kto h get khexd ulong and shr c uint mul sub 7 h 4 15 45 end 46 put kto 8 10 47 w = write 1 kto 0 9 48 if ne w 9 49 ret 5 50 end 51 ret 0 52 end