From: Stefan Krah Date: Sun, 10 Jun 2012 14:50:55 +0000 (+0200) Subject: 1) State restrictions for the transform length. X-Git-Tag: v3.3.0b1~245 X-Git-Url: http://git.ipfire.org/gitweb.cgi?a=commitdiff_plain;h=9253862f45047f66460949e474cf97fa19d2629c;p=thirdparty%2FPython%2Fcpython.git 1) State restrictions for the transform length. 2) Switch argument order to match the function signature of mpd_calloc() (cosmetic change, since the order is irrelevant). --- diff --git a/Modules/_decimal/libmpdec/mpdecimal.c b/Modules/_decimal/libmpdec/mpdecimal.c index 40d33cf19e5c..f5be7474009f 100644 --- a/Modules/_decimal/libmpdec/mpdecimal.c +++ b/Modules/_decimal/libmpdec/mpdecimal.c @@ -5158,7 +5158,11 @@ _mpd_kmul(const mpd_uint_t *u, const mpd_uint_t *v, } -/* Determine the minimum length for the number theoretic transform. */ +/* + * Determine the minimum length for the number theoretic transform. Valid + * transform lengths are 2**n or 3*2**n, where 2**n <= MPD_MAXTRANSFORM_2N. + * The function finds the shortest length m such that rsize <= m. + */ static inline mpd_size_t _mpd_get_transform_len(mpd_size_t rsize) { @@ -5169,6 +5173,7 @@ _mpd_get_transform_len(mpd_size_t rsize) log2rsize = mpd_bsr(rsize); if (rsize <= 1024) { + /* 2**n is faster in this range. */ x = ((mpd_size_t)1)<