34 lines
956 B
Text
34 lines
956 B
Text
`(== 64 64)
|
|
(de mmap (L F)
|
|
(native "@" "mmap" 'N 0 L 1 2 F 0) )
|
|
(de munmap (A L)
|
|
(native "@" "munmap" 'N A L) )
|
|
(de xxh64 (M S)
|
|
(let
|
|
(R (native "libxxhash.so" "XXH64" 'N M S 0)
|
|
P `(** 2 64) )
|
|
(if (lt0 R)
|
|
(& (+ R P) (dec P))
|
|
R ) ) )
|
|
(de walk (Dir)
|
|
(recur (Dir)
|
|
(for F (dir Dir)
|
|
(let (Path (pack Dir "/" F) Info (info Path T))
|
|
(when (car Info)
|
|
(if (=T (car Info))
|
|
(recurse Path)
|
|
(if (lup D (car Info))
|
|
(push (cdr @) Path)
|
|
(idx 'D (list (car Info) (cons Path)) T) ) ) ) ) ) ) )
|
|
(off D)
|
|
(walk "/bin")
|
|
(for Lst (filter cdadr (idx 'D))
|
|
(let L
|
|
(by
|
|
'((F)
|
|
(let (M (mmap (car Lst) (open F T))
|
|
S (car Lst) )
|
|
(prog1 (xxh64 M S) (munmap M S)) ) )
|
|
group
|
|
(cadr Lst) )
|
|
(and (filter cdr L) (println (car Lst) @)) ) )
|