fixed uint/ulong pointer ref bug (and added appropriate tests).

This commit is contained in:
Abdulaziz Ghuloum
2008-09-14 00:38:59 -07:00
parent 58d937c520
commit 9f2d7484ab
7 changed files with 55 additions and 150 deletions
+10 -7
View File
@@ -43,20 +43,23 @@
(if (< n 0)
'()
(cons (sll 1 n) (one-bit-combinations n)))))
(define (two-bit-combinations n)
(define (or* ls1 ls2)
(apply append
(map
(lambda (n1)
(map
(lambda (n2)
(bitwise-ior n1 n2))
(one-bit-combinations n)))
(one-bit-combinations n))))
ls2))
ls1)))
(let ([n (min bits n)])
(append
(list 0)
(one-bit-combinations n)
(two-bit-combinations n))))
(let* ([ls1 (one-bit-combinations n)]
[ls2 (or* ls1 ls1)]
[ls3 (or* ls2 ls1)])
(append
(list 0 (sub1 (sll 1 (- n 1))) (sub1 (sll 1 n)))
ls1 ls2 ls3))))