From 3e7583b05de6e67fd103eb739a16d5f4971a91a0 Mon Sep 17 00:00:00 2001 From: Chris Hanson Date: Mon, 30 Apr 2018 10:55:24 -0700 Subject: [PATCH] Fix thinko as reported by Patric Jonsson. Incorrectly computed length of result in exact-nonnegative-integer->bytevector. --- src/runtime/bytevector.scm | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/src/runtime/bytevector.scm b/src/runtime/bytevector.scm index da6aefeab..6aa8efbb9 100644 --- a/src/runtime/bytevector.scm +++ b/src/runtime/bytevector.scm @@ -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))) -- 2.25.1