Function: gamegrid-insert-xbm-bits
gamegrid-insert-xbm-bits is a byte-compiled function defined in
gamegrid.el.gz.
Signature
(gamegrid-insert-xbm-bits STR)
Documentation
Convert binary to hex and insert in current buffer.
STR should be a string composed of 1s and 0s and be a multiple of
8 in length. Divide it into 8 bit bytes, reverse the order of
each, convert them to hex and insert them in comma separated C
format.
Source Code
;; Defined in /usr/src/emacs/lisp/play/gamegrid.el.gz
(defun gamegrid-insert-xbm-bits (str)
"Convert binary to hex and insert in current buffer.
STR should be a string composed of 1s and 0s and be a multiple of
8 in length. Divide it into 8 bit bytes, reverse the order of
each, convert them to hex and insert them in comma separated C
format."
(let ((byte-count (/ (length str) 8)))
(dotimes (i byte-count)
(let* ((byte (reverse (substring str (* i 8) (+ (* i 8) 8))))
(value (string-to-number byte 2)))
(insert (format "0x%02x" value))
(unless (= i (1- byte-count))
(insert ", "))))))