fixed string->color
This commit is contained in:
parent
b87531989a
commit
e62303f795
|
@ -65,10 +65,10 @@
|
|||
|
||||
(define (string->color str)
|
||||
(let ((colornumber 0))
|
||||
(do ((i 0 (+ i 1)))
|
||||
((< i (string-length str)) colornumber)
|
||||
(let* ((c (string-ref str i))
|
||||
(n (cond ((or (eq? c #\a)(eq? c #\A))
|
||||
(do ((i (- (string-length str) 1) (- i 1)))
|
||||
((< i 0) colornumber)
|
||||
(let ((c (string-ref str i)))
|
||||
(let ((n (cond ((or (eq? c #\a)(eq? c #\A))
|
||||
10)
|
||||
((or (eq? c #\b)(eq? c #\B))
|
||||
11)
|
||||
|
@ -81,7 +81,7 @@
|
|||
((or (eq? c #\f)(eq? c #\F))
|
||||
15)
|
||||
(else (string->number (string c))))))
|
||||
(set! colornumber (+ (* n 16) colornumber))))))
|
||||
(set! colornumber (+ (* (+ n 1) 16 i) colornumber)))))))
|
||||
|
||||
(define (little-endian->big-endian n)
|
||||
(let ((str (string n))
|
||||
|
|
Loading…
Reference in New Issue