fix tl-map parse & marshal

This commit is contained in:
Matthew Flatt 2011-05-09 12:24:05 -06:00
parent a4da2a3f4c
commit 8ad8d5b7f7
2 changed files with 6 additions and 5 deletions

View File

@ -978,7 +978,8 @@
num-all-params
max-let-depth
(and tl-map
(if (tl-map . < . #x7FFFFFFF)
(if (tl-map . <= . #xFFFFFFF)
;; Encode as a fixnum:
tl-map
;; Encode as an even-sized vector of 16-bit integers:
(let ([len (* 2 (quotient (+ (integer-length tl-map) 31) 32))])

View File

@ -136,9 +136,9 @@
(and tl-map
(let* ([bits (if (exact-integer? tl-map)
tl-map
(for/fold ([i 0]) ([v (in-list tl-map)]
(for/fold ([i 0]) ([v (in-vector tl-map)]
[s (in-naturals)])
(bitwise-ior i (arithmetic-shift v 16))))]
(bitwise-ior i (arithmetic-shift v (* s 16)))))]
[len (integer-length bits)])
(list->set
(let loop ([bit 0])