Fix thinko as reported by Patric Jonsson.
authorChris Hanson <org/chris-hanson/cph>
Mon, 30 Apr 2018 17:55:24 +0000 (10:55 -0700)
committerChris Hanson <org/chris-hanson/cph>
Mon, 30 Apr 2018 17:55:24 +0000 (10:55 -0700)
Incorrectly computed length of result in exact-nonnegative-integer->bytevector.

src/runtime/bytevector.scm

index da6aefeab13e195ea16151de054cc2a55a8029b9..6aa8efbb9de38233fd7c6b732c18b9ca333e744c 100644 (file)
@@ -467,7 +467,7 @@ USA.
 (define (exact-nonnegative-integer->bytevector n)
   (guarantee exact-nonnegative-integer? n
             'exact-nonnegative-integer->bytevector)
-  (let* ((n-bytes (quotient (+ (integer-length-in-bits n) #xFF) #x100))
+  (let* ((n-bytes (quotient (+ (integer-length-in-bits n) 7) 8))
         (result (make-bytevector n-bytes)))
     (do ((n n (quotient n #x100))
         (i 0 (fix:+ i 1)))