anchor.diff:      (if (> num max)
           (lognot (- (1- (ash 1 bits)) num))
           num)))
  -
  -(macrolet ((frob-signed-integer-converter (bits)
  -             (let ((function-name
  -                    (intern
  -                     (string-upcase (format nil "convert-to-signed-~A" bits))))
  -                   (maxpos (1- (ash 1 (1- bits))))
  -                   (logval (1- (ash 1 bits))))
  -               `(defun ,function-name (num)
  -                  (if (> num ,maxpos)
  -                      (lognot (- ,logval num))
  -                      num)))))
  -  (frob-signed-integer-converter 8)
  -  (frob-signed-integer-converter 16)
  -  (frob-signed-integer-converter 24)
  -  (frob-signed-integer-converter 32)
  -  (frob-signed-integer-converter 64))
   
   (defun convert-to-unsigned-integer (num bits)
     (if (minusp num)
  
positive.code:   (let (*byte-order*)
      (call-next-method)))
  
  (defun read-tiff-stream (stream)
    (read-value 'tiff stream))
  
  (defun write-tiff-stream (stream obj &key (byte-order :big-endian))
    (let ((*byte-order* byte-order))
      (write-value 'tiff stream obj)))
  
  
negative.code:   (:shadow #:rational #:numerator #:denominator))
  
  (in-package :retrospectiff2)
  
  (defconstant +image-width-tag+ 256)
  (defconstant +image-length-tag+ 257)
  (defconstant +bits-per-sample-tag+ 258)
  (defconstant +compression-tag+ 259)
  (defconstant +photometric-interpretation-tag+ 262)
  (defconstant +strip-offsets-tag+ 273)
  (defconstant +samples-per-pixel-tag+ 277)
  (defconstant +rows-per-strip-tag+ 278)
  (defconstant +rows-per-strip-tag+ 278)
  (defconstant +strip-byte-counts-tag+ 279)
  (defconstant +x-resolution-tag+ 282)
  (defconstant +y-resolution-tag+ 283)
  (defconstant +planar-configuration-tag+ 284)
  (defconstant +resolution-unit-tag+ 296)
  (defconstant +predictor-tag+ 317)
  
  (defconstant +photometric-interpretation-white-is-zero+ 0)
  (defconstant +photometric-interpretation-black-is-zero+ 1)
  (defconstant +photometric-interpretation-rgb+ 2)
  
  (defconstant +horizontal-differencing+ 2)
  
  (defconstant +packbits-compression+ #x8005)
  (defconstant +lzw-compression+ 5)
  
  (defconstant +field-type-byte+ 1)
  (defconstant +field-type-ascii+ 2)
  (defconstant +field-type-short+ 3)
  (defconstant +field-type-long+ 4)
  (defconstant +field-type-rational+ 5)
  (defconstant +field-type-sbyte+ 6)
  (defconstant +field-type-undefined+ 7)
  (defconstant +field-type-sshort+ 8)
  (defconstant +field-type-slong+ 9)
  (defconstant +field-type-srational+ 10)
  (defconstant +field-type-float+ 11)
  (defconstant +field-type-double+ 12)
  
  (defconstant +exif-tag+ 34665)
  (defconstant +icc-profile-tag+ 34675)
  
  
  (defparameter *byte-order* nil)
  
  