fixed string->color

This commit is contained in:
Johan Ceuppens 2012-01-16 22:36:10 +00:00
parent b87531989a
commit e62303f795
1 changed files with 17 additions and 17 deletions

View File

@ -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))