cpython: 6fcdd1657ee3 (original) (raw)

Mercurial > cpython

changeset 85982:6fcdd1657ee3

Issue #19171: speed some cases of 3-argument long pow(). Reduce the base by the modulus when the base is larger than the modulus. This can unboundedly speed the "startup costs" of doing modular exponentiation, particularly in cases where the base is much larger than the modulus. Original patch by Armin Rigo, inspired by https://github.com/pyca/ed25519\. Merged from 3.3. [#19171]

Tim Peters tim@python.org
date Sat, 05 Oct 2013 16:55:38 -0500
parents 63a10c942b50(current diff)f34c59494420(diff)
children 94246efe2275
files Objects/longobject.c
diffstat 1 files changed, 10 insertions(+), 4 deletions(-)[+] [-] Objects/longobject.c 14

line wrap: on

line diff

--- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -3878,10 +3878,16 @@ long_pow(PyObject *v, PyObject *w, PyObj goto Done; }