u32 writing in a pinch pasted by zbigniew the absurd on Fri Aug 17 06:04:48 2012
;; terribly inefficient, from osxattr egg (define (char x) (integer->char (bitwise-and x 255))) (define (write-u32 x) (write-char (char (arithmetic-shift x -24))) (write-char (char (arithmetic-shift x -16))) (write-char (char (arithmetic-shift x -8))) (write-char (char x))) ;; (write-u32 #x61626364) ;; abcd ;; equivalent definition of write-u32 that should also work (define (write-u32 x) (display (string (char (arithmetic-shift x -24))) (char (arithmetic-shift x -16))) (char (arithmetic-shift x -8))) (char x))))
it is best to test your code before pasting added by zbigniew the wronged on Fri Aug 17 06:07:26 2012
(define (write-u32 x)
(display
(string (char (arithmetic-shift x -24))
(char (arithmetic-shift x -16))
(char (arithmetic-shift x -8))
(char x))))