Changeset 193


Ignore:
Timestamp:
Jan 3, 2004, 3:23:26 PM (21 years ago)
Author:
Gary Byers
Message:

%BIGNUM-BIGNUM-GCD wasn't zeroing out the buffers it (re-)uses, so use
a simpler algorithm (that conses more) until this is fixed.

File:
1 edited

Legend:

Unmodified
Added
Removed
  • trunk/ccl/level-0/l0-bignum.lisp

    r80 r193  
    20002000        (logand mask (ash integer (- position)))))))   
    20012001
     2002(defun %bignum-bignum-gcd (n1 n2)
     2003  (labels ((integer-gcd-sub (n1 n2)
     2004             (if (eql n2 0)
     2005               n1
     2006               (if (and (typep n1 'fixnum) (typep n2 'fixnum))
     2007                 (%fixnum-gcd n1 n2)
     2008                 (integer-gcd-sub n2
     2009                                  (if (> n2 n1)
     2010                                    (rem n2 n1)
     2011                                    (rem n1 n2)))))))
     2012    (if (< n1 0) (setq n1 (bignum-abs n1)))
     2013    (if (< n2 0) (setq n2 (bignum-abs n2)))
     2014    (if (> n1 n2)
     2015      (integer-gcd-sub n1 n2)
     2016      (integer-gcd-sub n2 n1))))
     2017
     2018#+fix-later
    20022019(defun %bignum-bignum-gcd (u0 v0)
    20032020  (let* ((u-len (%bignum-length u0))
Note: See TracChangeset for help on using the changeset viewer.