[functional-tests] Knock up some crc32c code.

This works 1 byte at a time so will be slow.
This commit is contained in:
Joe Thornber
2017-10-04 10:25:32 +01:00
parent 8b7e5acc48
commit 5fd33b9560
4 changed files with 114 additions and 1 deletions

View File

@@ -17,9 +17,11 @@
spine-step
spine-current
spine-parent
with-spine)
with-spine
checksum-block)
(import (chezscheme)
(crc32c checksum)
(fmt fmt)
(srfi s8 receive)
(utils))
@@ -157,4 +159,14 @@
(spine-step% sp index flags)
(let ((b (spine-current sp)))
b1 b2 ...)))))
;;;--------------------------------------------------------
;;; Checksumming
;;;--------------------------------------------------------
(define md-block-size 4096)
(define (checksum-block b offset salt)
(let ((ptr (make-ftype-pointer unsigned-8
(+ (block-data b) offset))))
(bitwise-xor salt (crc32c #xffffffff ptr (- md-block-size offset)))))
)