;;; %bignum-length %bignum-set-length %bignum-ref %bignum-set
;;; %digit-0-or-plusp %add-with-carry %subtract-with-borrow
;;; %multiply-and-add %multiply %lognot %logand %logior %logxor
;;; %bignum-length %bignum-set-length %bignum-ref %bignum-set
;;; %digit-0-or-plusp %add-with-carry %subtract-with-borrow
;;; %multiply-and-add %multiply %lognot %logand %logior %logxor
;;; %ashr %digit-logical-shift-right))
;;; The following interfaces will either be assembler routines or code
;;; %ashr %digit-logical-shift-right))
;;; The following interfaces will either be assembler routines or code
;;; dividing the first two as a 2*digit-size integer by the third.
;;;
;;; Do weird LET and SETQ stuff to bamboozle the compiler into allowing
;;; dividing the first two as a 2*digit-size integer by the third.
;;;
;;; Do weird LET and SETQ stuff to bamboozle the compiler into allowing
;;; Convert the digit to a regular integer assuming that the digit is signed.
(defun %fixnum-digit-with-correct-sign (digit)
;;; Convert the digit to a regular integer assuming that the digit is signed.
(defun %fixnum-digit-with-correct-sign (digit)
(setf u (copy-bignum u u-len))
(let ((n (bignum-mod-gcd v1 u)))
(ash (bignum-mod-gcd u1 (if (fixnump n)
(setf u (copy-bignum u u-len))
(let ((n (bignum-mod-gcd v1 u)))
(ash (bignum-mod-gcd u1 (if (fixnump n)
;;; digit-size quantities for the q-digit and r-digit. If Y is
;;; a single digit bignum, it is already large enough for
;;; digit-size quantities for the q-digit and r-digit. If Y is
;;; a single digit bignum, it is already large enough for
;;; remainder fit in digit-size.
(shift-y-for-truncate (y)
(let* ((len (%bignum-length y))
;;; remainder fit in digit-size.
(shift-y-for-truncate (y)
(let* ((len (%bignum-length y))
;;;; There used to be a pile of code for implementing division for bignum digits
;;;; for machines that don't have a 2*digit-size by digit-size divide instruction.
;;;; This happens to be most machines, but all the SBCL ports seem to be content
;;;; There used to be a pile of code for implementing division for bignum digits
;;;; for machines that don't have a 2*digit-size by digit-size divide instruction.
;;;; This happens to be most machines, but all the SBCL ports seem to be content