anchor.diff:          (values (+ tru 1) (- rem divisor))
           (values tru rem))))
   
  +(define-lap-function %%bignum-< ()
  +  (sys.lap-x86:push 0) ; align
  +  ;; Read lengths.
  +  (sys.lap-x86:mov64 :rax (:r8 #.(- +tag-array-like+)))
  +  (sys.lap-x86:mov64 :rdx (:r9 #.(- +tag-array-like+)))
  +  (sys.lap-x86:shr64 :rax 8)
  +  (sys.lap-x86:shr64 :rdx 8)
  +  ;; Pick the longest length.
  +  (sys.lap-x86:mov64 :rcx :rax)
  +  (sys.lap-x86:cmp64 :rax :rdx)
  +  (sys.lap-x86:cmov64g :rcx :rdx)
  +  (sys.lap-x86:xor64 :rbx :rbx) ; offset
  +  (sys.lap-x86:xor64 :r10 :r10) ; CF save register.
  +  (sys.lap-x86:shl64 :rax 3)
  +  (sys.lap-x86:shl64 :rdx 3)
  +  loop
  +  (sys.lap-x86:cmp64 :rbx :rax)
  +  (sys.lap-x86:jae sx-left)
  +  (sys.lap-x86:mov64 :rsi (:r8 #.(+ (- +tag-array-like+) 8) :rbx))
  +  sx-left-resume
  +  (sys.lap-x86:cmp64 :rbx :rdx)
  +  (sys.lap-x86:jae sx-right)
  +  (sys.lap-x86:mov64 :rdi (:r9 #.(+ (- +tag-array-like+) 8) :rbx))
  +  sx-right-resume
  +  (sys.lap-x86:add64 :rbx 8)
  +  (sys.lap-x86:sub64 :rcx 1)
  +  (sys.lap-x86:jz last-compare)
  +  (sys.lap-x86:clc) ; Avoid setting low bits in r10.
  +  (sys.lap-x86:rcl64 :r10 1) ; Restore saved carry.
  +  (sys.lap-x86:sbb64 :rsi :rdi)
  +  (sys.lap-x86:rcr64 :r10 1) ; Save carry.
  +  (sys.lap-x86:jmp loop)
  +  last-compare
  +  (sys.lap-x86:clc) ; Avoid setting low bits in r10.
  +  (sys.lap-x86:rcl64 :r10 1) ; Restore saved carry.
  +  (sys.lap-x86:sbb64 :rsi :rdi)
  +  (sys.lap-x86:mov64 :r8 nil)
  +  (sys.lap-x86:mov64 :r9 t)
  +  (sys.lap-x86:cmov64l :r8 :r9)
  +  (sys.lap-x86:mov32 :ecx 8)
  +  (sys.lap-x86:mov64 :rbx :lsp)
  +  (sys.lap-x86:add64 :csp 8)
  +  (sys.lap-x86:ret)
  +  sx-left
  +  ;; Sign extend the left argument (previous value in RSI).
  +  (sys.lap-x86:sar64 :rsi 63)
  +  (sys.lap-x86:jmp sx-left-resume)
  +  sx-right
  +  ;; Sign extend the right argument (previous value in RDI).
  +  (sys.lap-x86:sar64 :rdi 63)
  +  (sys.lap-x86:jmp sx-right-resume))
  +
   (defun generic-< (x y)
  -  (error "TODO"))
  -
  +  (check-type x number)
  +  (check-type y number)
  +  (cond
  +    ((and (fixnump x)
  +          (fixnump y))
  +     ;; Should be handled by binary-<.
  +     (error "FIXNUM/FIXNUM case hit GENERIC-<"))
  +    ((and (fixnump x)
  +          (bignump y))
  +     (%%bignum-< (%make-bignum-from-fixnum x) y))
  +    ((and (bignump x)
  +          (fixnump y))
  +     (%%bignum-< x (%make-bignum-from-fixnum y)))
  +    ((and (bignump x)
  +          (bignump y))
  +     (%%bignum-< x y))
  +    (t (error "TODO... Argument combination not supported."))))
  +
  +;; Implement these in terms of <.
   (defun generic->= (x y)
  +  (not (generic-< x y)))
  +
  +(defun generic-> (x y)
     (generic-< y x))
   
  -(defun generic-> (x y)
  -  (error "TODO"))
  -
   (defun generic-<= (x y)
  -  (generic-> y x))
  +  (not (generic-< y x)))
  +
  +(define-lap-function %%bignum-= ()
  +  (sys.lap-x86:push 0) ; align
  +  ;; Read headers.
  +  (sys.lap-x86:mov64 :rax (:r8 #.(- +tag-array-like+)))
  +  (sys.lap-x86:cmp64 :rax (:r9 #.(- +tag-array-like+)))
  +  (sys.lap-x86:jne different)
  +  ;; Same length, compare words.
  +  (sys.lap-x86:shr64 :rax 8)
  +  (sys.lap-x86:xor32 :ecx :ecx)
  +  loop
  +  (sys.lap-x86:mov64 :rdx (:r8 #.(+ (- +tag-array-like+) 8) (:rcx 8)))
  +  (sys.lap-x86:cmp64 :rdx (:r9 #.(+ (- +tag-array-like+) 8) (:rcx 8)))
  +  (sys.lap-x86:jne different)
  +  test
  +  (sys.lap-x86:add64 :rcx 1)
  +  (sys.lap-x86:cmp64 :rcx :rax)
  +  (sys.lap-x86:jb loop)
  +  (sys.lap-x86:mov64 :r8 t)
  +  done
  +  (sys.lap-x86:pop :rax)
  +  (sys.lap-x86:mov32 :ecx 8)
  +  (sys.lap-x86:mov64 :rbx :lsp)
  +  (sys.lap-x86:ret)
  +  different
  +  (sys.lap-x86:mov64 :r8 nil)
  +  (sys.lap-x86:jmp done))
   
   (defun generic-= (x y)
  -  (error "TODO"))
  +  (check-type x number)
  +  (check-type y number)
  +  (when (eq x y)
  +    (return-from generic-= t))
  +  (cond
  +    ((or (fixnump x)
  +         (fixnump y))
  +     ;; Would have been caught by the EQ.
  +     ;; TODO: comparing against floats.
  +     nil)
  +    ((and (bignump x)
  +          (bignump y))
  +     (%%bignum-= x y))
  +    (t (error "TODO... Argument combination not supported."))))
  +
  +(define-lap-function %%bignum-truncate ()
  +  ;; Read headers.
  +  (sys.lap-x86:mov64 :rax (:r8 #.(- +tag-array-like+)))
  +  (sys.lap-x86:mov64 :rdx (:r9 #.(- +tag-array-like+)))
  +  (sys.lap-x86:shr64 :rax 8)
  +  (sys.lap-x86:shr64 :rdx 8)
  +  ;; TODO: Full division...
  +  (sys.lap-x86:cmp64 :rax 1)
  +  (sys.lap-x86:jne not-implemented)
  +  (sys.lap-x86:cmp64 :rdx 1)
  +  (sys.lap-x86:jne not-implemented)
  +  ;; 64-bit divide.
  +  (sys.lap-x86:mov64 :rax (:r8 #.(+ (- +tag-array-like+) 8)))
  +  (sys.lap-x86:mov64 :rcx (:r9 #.(+ (- +tag-array-like+) 8)))
  +  (sys.lap-x86:cqo)
  +  ;; Quotient in RAX, remainder in RDX.
  +  (sys.lap-x86:idiv64 :rcx)
  +  (sys.lap-x86:push :rdx)
  +  ;; Attempt to convert quotient to a fixnum.
  +  (sys.lap-x86:mov64 :rcx :rax)
  +  (sys.lap-x86:imul64 :rax 8)
  +  (sys.lap-x86:jo quotient-bignum)
  +  (sys.lap-x86:mov64 :r8 :rax)
  +  done-quotient
  +  (sys.lap-x86:mov64 (:lsp -8) nil)
  +  (sys.lap-x86:sub64 :lsp 8)
  +  (sys.lap-x86:mov64 (:lsp) :r8)
  +  ;; Attempt to convert remainder to a fixnum.
  +  (sys.lap-x86:mov64 :rax (:csp))
  +  (sys.lap-x86:imul64 :rax 8)
  +  (sys.lap-x86:jo remainder-bignum)
  +  (sys.lap-x86:mov64 :r9 :rax)
  +  done-remainder
  +  (sys.lap-x86:pop :rax)
  +  (sys.lap-x86:mov64 :r8 (:lsp))
  +  (sys.lap-x86:add64 :lsp 8)
  +  (sys.lap-x86:mov32 :ecx 16)
  +  (sys.lap-x86:mov64 :rbx :lsp)
  +  (sys.lap-x86:ret)
  +  ;; Allocate a bignum for the quotient in RCX.
  +  quotient-bignum
  +  (sys.lap-x86:mov64 :rax :rcx)
  +  (sys.lap-x86:mov64 :r13 (:constant %%make-bignum-64-rax))
  +  (sys.lap-x86:call (:symbol-function :r13))
  +  (sys.lap-x86:mov64 :lsp :rbx)
  +  (sys.lap-x86:jmp done-quotient)
  +  ;; Allocate a bignum for the quotient in RCX.
  +  remainder-bignum
  +  (sys.lap-x86:mov64 :rax (:csp))
  +  (sys.lap-x86:mov64 :r13 (:constant %%make-bignum-64-rax))
  +  (sys.lap-x86:call (:symbol-function :r13))
  +  (sys.lap-x86:mov64 :lsp :rbx)
  +  (sys.lap-x86:mov64 :r9 :r8)
  +  (sys.lap-x86:jmp done-remainder)
  +  not-implemented
  +  (sys.lap-x86:mov64 :r8 (:constant "Full bignum TRUNCATE not implemented."))
  +  (sys.lap-x86:mov64 :r13 (:constant error))
  +  (sys.lap-x86:mov32 :ecx 8)
  +  (sys.lap-x86:push 0)
  +  (sys.lap-x86:call (:symbol-function :r13)))
   
   (defun generic-truncate (number divisor)
  -  (error "TODO"))
  +  (assert (/= divisor 0) (number divisor) 'division-by-zero)
  +  ;; Avoid overflow when doing fixnum arithmetic.
  +  (when (and (eq divisor -1)
  +             (integerp number))
  +    (return-from generic-truncate
  +      (values (- number) 0)))
  +  (cond ((and (fixnump number)
  +              (fixnump divisor))
  +         (error "FIXNUM/FIXNUM case hit GENERIC-TRUNCATE"))
  +        ((and (fixnump number)
  +              (bignump divisor))
  +         (%%bignum-truncate (%make-bignum-from-fixnum number)
  +                            divisor))
  +        ((and (bignump number)
  +              (fixnump divisor))
  +         (%%bignum-truncate number
  +                            (%make-bignum-from-fixnum divisor)))
  +        ((and (bignump number)
  +              (bignump divisor))
  +         (%%bignum-truncate number divisor))
  +        (t (error "Argument combination not supported."))))
   
   (defun generic-rem (number divisor)
     (multiple-value-bind (quot rem)
  
positive.code: (defun generic-+ (x y)
    (error "TODO"))
  
  (defun generic-- (x y)
    (error "TODO"))
  
  (defun generic-* (x y)
    (error "TODO"))
  
negative.code: (in-package #:sys.int)
  
  (defun integerp (object)
    (or (system:fixnump object)
        (bignump object)))
  
  (defun realp (object)
    (integerp object))
  