• Tim Peters's avatar
    SF patch 936813: fast modular exponentiation · 47e52ee0
    Tim Peters yazdı
    This checkin is adapted from part 2 (of 3) of Trevor Perrin's patch set.
    
    BACKWARD INCOMPATIBILITY:  SHIFT must now be divisible by 5.  AFAIK,
    nobody will care.  long_pow() could be complicated to worm around that,
    if necessary.
    
    long_pow():
      - BUGFIX:  This leaked the base and power when the power was negative
        (and so the computation delegated to float pow).
      - Instead of doing right-to-left exponentiation, do left-to-right.  This
        is more efficient for small bases, which is the common case.
      - In addition, if the exponent is large (more than FIVEARY_CUTOFF
        digits), precompute [a**i % c for i in range(32)], and go left to
        right 5 bits at a time.
    l_divmod():
      - The signature changed so that callers who don't want the quotient,
        or don't want the remainder, can pass NULL in the slot they don't
        want.  This saves them from having to declare a vrbl for unwanted
        stuff, and remembering to decref it.
    long_mod(), long_div(), long_classic_div():
      - Adjust to new l_divmod() signature, and simplified as a result.
    47e52ee0
Adı
Son kayıt (commit)
Son güncelleme
Demo Loading commit data...
Doc Loading commit data...
Grammar Loading commit data...
Include Loading commit data...
Lib Loading commit data...
Mac Loading commit data...
Misc Loading commit data...
Modules Loading commit data...
Objects Loading commit data...
PC Loading commit data...
PCbuild Loading commit data...
Parser Loading commit data...
Python Loading commit data...
RISCOS Loading commit data...
Tools Loading commit data...
.cvsignore Loading commit data...
.hgtags Loading commit data...
LICENSE Loading commit data...
Makefile.pre.in Loading commit data...
README Loading commit data...
aclocal.m4 Loading commit data...
configure Loading commit data...
configure.in Loading commit data...
install-sh Loading commit data...
pyconfig.h.in Loading commit data...
setup.py Loading commit data...