anchor.diff:                                (setf (aref buffer dpos) val))))))))
   
   ;;; Reads and decodes either whole scan or restart interval
  -(defun decode-chunk (image scan s)
  +(defun decode-chunk (image scan s zzbuf)
     "Reads and decodes either a whole scan (if no restarts) or restart interval"
     (let* ((nextbit (make-nextbit 0 0))
            (ncomp (scan-ncomp scan))
  
positive.code:     (read-byte s)
      (read-byte s)
      (if (= (descriptor-restart-interval image) 0)
          (decode-chunk image scan s) ; reading the whole scan at once
        (loop for term = (decode-chunk image scan s)
              while (eq 'restart term)
              finally (return term))))) ; or in pieces
  
  
negative.code: 
  ;;; Scan decoding subroutine
  (defun decode-scan (image i s)
    (let ((scan (aref (descriptor-scans image) i))
  	(zzbuf (2d-sint16-array
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0)
  			    '(0  0  0  0  0  0  0  0))))
      (read-byte s) ; length
      (read-byte s)
      (loop with ncomp fixnum = (setf (scan-ncomp scan) (read-byte s))
  