CRC-32: Difference between revisions

Content added Content deleted
(→‎{{header|TXR}}: Add FFI-to-Zlib version.)
(→‎Lisp Code: Use newer style iteration.)
Line 2,271: Line 2,271:
(let ((crc #xffffffff)
(let ((crc #xffffffff)
(l (len buf)))
(l (len buf)))
(for ((i 0)) ((< i l) (logxor crc #xffffffff)) ((inc i))
(each ((i 0..l))
(set crc (logxor [crc-tab (logand (logxor crc [buf i]) #xff)]
(set crc (logxor [crc-tab (logand (logxor crc [buf i]) #xff)]
(ash crc -8))))))</lang>
(ash crc -8))))
(logxor crc #xffffffff)))</lang>

{{out}}
{{out}}
<pre>$ ./txr -i crc.tl
<pre>$ ./txr -i crc.tl