anchor.diff:  ;;; NB: probably it's a good idea to encapsulate this behavior into a class, but I'm
   ;;; afraid that method dispatch would be too slow
   
  -(defvar *prev-byte* 0)
  -(declaim (type uint8 *prev-byte*))
  -
  -(defvar *prev-length* 0)
  -(declaim (type fixnum *prev-length* *prev-length*))
  -
  -(defun write-bits (bi ni s)
  +(defstruct (write-bits-state (:conc-name write-bits-))
  +  (prev-byte 0 :type uint8)
  +  (prev-length 0 :type fixnum))
  +
  +(defun write-bits (bi ni s write-bits-state)
     (declare #.*optimize*
              (type fixnum bi ni)
              (type stream s))
  
positive.code:                            (crunch sampled-buf pos q-tab)
                             (setf (aref preds cn)
                                   (encode-block (zigzag (aref sampled-buf pos) zz-result)
                                                 hufftabs (aref preds cn) out-stream)))))))))
      (unless (zerop *prev-length*)
        (write-stuffed (deposit-field #xff ; byte padding & flushing
                                      (byte (minus 8 *prev-length*) 0)
                                      (the fixnum (ash (the uint8 *prev-byte*) (the uint8 (minus 8 *prev-length*)))))
                       out-stream))
      (write-marker +M_EOI+ out-stream)))
  
  
negative.code:         (setq q-tabs q-tabs2))
        (loop for entry across q-tabs do  ; scaling all q-tables
             (q-scale entry q-factor)))
      (if (and (/= ncomp 1) (/= ncomp 3))
          (write-marker +M_SOI+ out-stream)
          (prepare-JFIF-stream out-stream))
  