diff --git a/module/language/cps/intset.scm b/module/language/cps/intset.scm index a6d3640ce..175b9e5b2 100644 --- a/module/language/cps/intset.scm +++ b/module/language/cps/intset.scm @@ -236,20 +236,20 @@ (define (visit-branch node shift i) (let lp ((i i) (idx (logand (ash i (- shift)) *branch-mask*))) (and (< idx *branch-size*) - (or (visit-node (vector-ref node idx) shift i) + (or (let ((node (vector-ref node idx))) + (and node (visit-node node shift i))) (let ((inc (ash 1 shift))) (lp (+ (round-down i shift) inc) (1+ idx))))))) (define (visit-node node shift i) - (and node - (if (= shift *leaf-bits*) - (visit-leaf node i) - (visit-branch node (- shift *branch-bits*) i)))) + (if (= shift *leaf-bits*) + (visit-leaf node i) + (visit-branch node (- shift *branch-bits*) i))) (match bs (($ min shift root) (let ((i (if (and i (< min i)) (- i min) 0))) - (and (< i (ash 1 shift)) + (and root (< i (ash 1 shift)) (let ((i (visit-node root shift i))) (and i (+ min i))))))))