anchor.diff:                            (loop for i below pad
                                do (write-value type out 0))))))))
   
  +
  +(defgeneric bytes-per-entry (class))
  +(defgeneric entry-bytes (ifd-entry))
  +
  +(defmethod entry-bytes ((entry ifd-entry))
  +  (* (value-count entry)
  +     (bytes-per-entry (class-of entry))))
  +
   ;; 1 - byte
   (define-binary-class byte-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u1 :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'byte-ifd-entry)))) 1)
   
   ;; 2 - ascii
   (define-binary-class ascii-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'iso-8859-1-char :size value-count :element-type 'character))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'ascii-ifd-entry)))) 1)
   
   ;; 3 -- short
   (define-binary-class short-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u2* :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'short-ifd-entry)))) 2)
   
   ;; 4 -- long
   (define-binary-class long-ifd-entry (ifd-entry)
     ((data (ifd-array :type 'u4* :size value-count))))
  +(defmethod bytes-per-entry ((class (eql (find-class 'long-ifd-entry)))) 4)
   
   ;; 5 -- rational
   (define-binary-class rational ()
  
positive.code:               while (plusp (next-ifd-offset ifd))))
    (:writer (out value)
             (loop for ifd in value
                do (write-value 'ifd out ifd))))
  
  (define-binary-class tiff-fields ()
    ((byte-order tiff-byte-order)
  
negative.code:                    :data data
                     :value-count (length data))))
  
  (defun make-ifd-entry-rational (tag data)
    (let ((data (vectorize data)))
      (make-instance 'rational-ifd-entry
                     :tag tag
                     :field-type +field-type-rational+
                     :data (map 'vector
                                (lambda (x)
                                  (make-instance 'rational :numerator (car x)
                                                 :denominator (cdr x)))
                                (print data))
                     :value-count (length data))))
  
  
  (defun ifd-entry-out-of-line-bytes (entry)
    (let ((bytes (entry-bytes entry)))
      (if (> bytes 4) bytes 0)))
  
  ;; we should return the number of strips (and possibly the length of
  ;; each strip (uncompressed), but not yet)..
  