Data commit
This commit is contained in:
parent
7387c8f97b
commit
cb5bb5e222
199093 changed files with 3378972 additions and 0 deletions
27
Task/CRC-32/PicoLisp/crc-32.l
Normal file
27
Task/CRC-32/PicoLisp/crc-32.l
Normal file
|
|
@ -0,0 +1,27 @@
|
|||
(setq *Table
|
||||
(mapcar
|
||||
'((N)
|
||||
(do 8
|
||||
(setq N
|
||||
(if (bit? 1 N)
|
||||
(x| (>> 1 N) `(hex "EDB88320"))
|
||||
(>> 1 N) ) ) ) )
|
||||
(range 0 255) ) )
|
||||
|
||||
(de crc32 (Lst)
|
||||
(let Crc `(hex "FFFFFFFF")
|
||||
(for I (chop Lst)
|
||||
(setq Crc
|
||||
(x|
|
||||
(get
|
||||
*Table
|
||||
(inc (x| (& Crc 255) (char I))) )
|
||||
(>> 8 Crc) ) ) )
|
||||
(x| `(hex "FFFFFFFF") Crc) ) )
|
||||
|
||||
(let Str "The quick brown fox jumps over the lazy dog"
|
||||
(println (hex (crc32 Str)))
|
||||
(println
|
||||
(hex (native "libz.so" "crc32" 'N 0 Str (length Str))) ) )
|
||||
|
||||
(bye)
|
||||
Loading…
Add table
Add a link
Reference in a new issue