notes on binary data added by r1b on Thu Apr 18 00:46:36 2019

; packing a u32 (little endian) for output to port

; using blobs and srfi-4

(define (pack-u32 n)
 (byte-blob->string (endian-blob-object (u32vector->endian-blob (u32vector n) LSB))))

; using strings and srfi-33

(define (pack-u32 n)
  (list->string (map integer->char
                     (list (bitwise-and n #x000000ff)
                           (arithmetic-shift (bitwise-and n #x0000ff00) -8)
                           (arithmetic-shift (bitwise-and n #x00ff0000) -16)
                           (arithmetic-shift (bitwise-and n #xff000000) -24)))))