X-Git-Url: http://repo.macrolet.net/gitweb/?a=blobdiff_plain;f=src%2Fcompiler%2Fgeneric%2Fgenesis.lisp;h=93ebd3c507f14959ef6e044030175c3bc0cc4ff8;hb=7f579b076a1fc54587538ead07e506e7f06f3fe8;hp=e633d66019364a99ed55aabd27d48a3030da1e2d;hpb=9a0890f2e981ef940888a25ca757762f714c4a9f;p=sbcl.git diff --git a/src/compiler/generic/genesis.lisp b/src/compiler/generic/genesis.lisp index e633d66..93ebd3c 100644 --- a/src/compiler/generic/genesis.lisp +++ b/src/compiler/generic/genesis.lisp @@ -130,10 +130,14 @@ +smallvec-length+)) ;;; analogous to WRITE-SEQUENCE, but for a BIGVEC -(defun write-bigvec-as-sequence (bigvec stream &key (start 0) end) - (loop for i of-type index from start below (or end (bvlength bigvec)) do - (write-byte (bvref bigvec i) - stream))) +(defun write-bigvec-as-sequence (bigvec stream &key (start 0) end pad-with-zeros) + (let* ((bvlength (bvlength bigvec)) + (data-length (min (or end bvlength) bvlength))) + (loop for i of-type index from start below data-length do + (write-byte (bvref bigvec i) + stream)) + (when (and pad-with-zeros (< bvlength data-length)) + (loop repeat (- data-length bvlength) do (write-byte 0 stream))))) ;;; analogous to READ-SEQUENCE-OR-DIE, but for a BIGVEC (defun read-bigvec-as-sequence-or-die (bigvec stream &key (start 0) end) @@ -3172,7 +3176,8 @@ initially undefined function references:~2%") ;; 8K). (write-bigvec-as-sequence (gspace-bytes gspace) *core-file* - :end total-bytes) + :end total-bytes + :pad-with-zeros t) (force-output *core-file*) (file-position *core-file* posn)