no title added by anonymous on Sat Jan 2 15:55:17 2021
;; Bitvector in protocol byte order (little endian) → integer in host byte order (define (ptoh octet-size bv) ;; Procedures to convert bytevector index to shift value for LE and BE. (define (shle idx) (* idx 8)) ;; INDEX * 8 (define (shbe idx) (- octet-size (+ 1 (* idx 8)))) ;; BYTE-SIZE - ((INDEX + 1) * 8) (let ((shift-proc (if (memq 'little-endian (features)) shle shbe))) ;; Use shle on LE and shbe on BE platforms (apply bitwise-ior (map (lambda (index) (arithmetic-shift (bytevector-u8-ref bv index) ;; Get nth byte from vector (shift-proc index))) ;; Shift according to byte order (range octet-size)))))