Commit message (Collapse) | Author | Age | Files | Lines | |
---|---|---|---|---|---|
* | Issue #19171: speed some cases of 3-argument long pow(). | Tim Peters | 2013-10-05 | 1 | -4/+10 |
| | | | | | | | | | 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. (grafted from f34c59494420765b013136ca93f63b716d9f1d30) | ||||
* | Issue #15989: Fix several occurrences of integer overflow | Serhiy Storchaka | 2013-01-19 | 1 | -0/+18 |
| | | | | | | | when result of PyInt_AsLong() or PyLong_AsLong() narrowed to int without checks. This is a backport of changesets 13e2e44db99d and 525407d89277. | ||||
* | Issue #16761: Raise TypeError when int() or long() called with base argument ↵ | Serhiy Storchaka | 2012-12-28 | 1 | -1/+7 |
| | | | | only. | ||||
* | Issue #14783: Backport changes from 3.2. | Chris Jerdonek | 2012-10-08 | 1 | -6/+12 |
| | |||||
* | #11565: Fix several typos. Patch by Piotr Kasprzyk. | Ezio Melotti | 2011-03-16 | 1 | -1/+1 |
| | |||||
* | #11515: fix several typos. Patch by Piotr Kasprzyk. | Ezio Melotti | 2011-03-15 | 1 | -1/+1 |
| | |||||
* | Wrap multiline macros in a 'do {} while(0)', for safety. | Mark Dickinson | 2010-05-09 | 1 | -37/+43 |
| | |||||
* | Post-detabification cleanup: whitespace fixes and long line rewraps only. | Mark Dickinson | 2010-05-09 | 1 | -159/+155 |
| | |||||
* | Untabify C files. Will watch buildbots. | Antoine Pitrou | 2010-05-09 | 1 | -3374/+3374 |
| | |||||
* | Issue #8659: Remove redundant ABS calls. Thanks Daniel Stutzbach. | Mark Dickinson | 2010-05-08 | 1 | -5/+2 |
| | |||||
* | Issue #8328: Silence Visual Studio warnings. | Stefan Krah | 2010-04-07 | 1 | -6/+6 |
| | |||||
* | Silence a 'comparison between signed and unsigned integer expressions' gcc ↵ | Mark Dickinson | 2010-04-06 | 1 | -1/+1 |
| | | | | warning. | ||||
* | Issue #8259: Get rid of 'outrageous left shift count' error when | Mark Dickinson | 2010-04-06 | 1 | -14/+6 |
| | | | | | left-shifting an integer by more than 2**31 on a 64-bit machine. Also convert shift counts to a Py_ssize_t instead of a C long. | ||||
* | Issue #7767: Add new C-API function PyLong_AsLongLongAndOverflow, a | Mark Dickinson | 2010-01-30 | 1 | -0/+104 |
| | | | | | long long variant of PyLong_AsLongAndOverflow. Patch by Case Van Horsen. | ||||
* | Refactor some longobject internals: PyLong_AsDouble and _PyLong_AsScaledDouble | Mark Dickinson | 2010-01-02 | 1 | -221/+146 |
| | | | | | | | | (the latter renamed to _PyLong_Frexp) now use the same core code. The exponent produced by _PyLong_Frexp now has type Py_ssize_t instead of the previously used int, and no longer needs scaling by PyLong_SHIFT. This frees the math module from having to know anything about the PyLong implementation. This closes issue #5576. | ||||
* | Issue #1811: Improve accuracy and consistency of true division for integers. | Mark Dickinson | 2009-12-27 | 1 | -31/+252 |
| | |||||
* | Issue #7528: Backport PyLong_AsLongAndOverflow from py3k to trunk. | Mark Dickinson | 2009-12-21 | 1 | -31/+101 |
| | | | | Thanks Case Van Horsen for the patch. | ||||
* | Issue #1087418: Small performance boost for bitwise operations on longs. | Mark Dickinson | 2009-10-25 | 1 | -66/+100 |
| | | | | Initial patch by Gregory Smith; some tweaks added. | ||||
* | Style/consistency/nano-optimization nit: replace occurrences of | Mark Dickinson | 2009-09-28 | 1 | -6/+6 |
| | | | | | | | | | | (high_bits << PyLong_SHIFT) + low_bits with (high_bits << PyLong_SHIFT) | low_bits in Objects/longobject.c. Motivation: - shouldn't unnecessarily mix bit ops with arithmetic ops (style) - this pattern should be spelt the same way thoughout (consistency) - it's very very very slightly faster: no need to worry about carries to the high digit (nano-optimization). | ||||
* | Silence MSVC compiler warnings. | Mark Dickinson | 2009-09-21 | 1 | -2/+3 |
| | |||||
* | Issue #6713: Improve performance of str(n) and repr(n) for integers n | Mark Dickinson | 2009-09-16 | 1 | -0/+119 |
| | | | | | (up to 3.1 times faster in tests), by special-casing base 10 in _PyLong_Format. (Backport of r74851 from py3k.) | ||||
* | Fix potential signed-overflow bug in _PyLong_Format; also fix | Mark Dickinson | 2009-09-13 | 1 | -9/+11 |
| | | | | a couple of whitespace issues. | ||||
* | Remove redundant assignment | Mark Dickinson | 2009-09-06 | 1 | -1/+0 |
| | |||||
* | Remove unnecessary use of context for long getters. | Mark Dickinson | 2009-05-02 | 1 | -10/+15 |
| | | | | (Related to issue #5880). | ||||
* | Issue #3166: Make long -> float (and int -> float) conversions | Mark Dickinson | 2009-04-20 | 1 | -15/+152 |
| | | | | | | correctly rounded, using round-half-to-even. This ensures that the value of float(n) doesn't depend on whether we're using 15-bit digits or 30-bit digits for Python longs. | ||||
* | sys.long_info attributes should be ints, not longs | Mark Dickinson | 2009-04-02 | 1 | -2/+4 |
| | |||||
* | Issue #5512: speed up the long division algorithm for Python longs. | Mark Dickinson | 2009-03-23 | 1 | -94/+152 |
| | | | | | | | | | | | | | | | The basic algorithm remains the same; the most significant speedups come from the following three changes: (1) normalize by shifting instead of multiplying and dividing (2) the old algorithm usually did an unnecessary extra iteration of the outer loop; remove this. As a special case, this means that long divisions with a single-digit result run twice as fast as before. (3) make inner loop much tighter. Various benchmarks show speedups of between 50% and 150% for long integer divisions and modulo operations. | ||||
* | Issue #4258: Use 30-bit digits for Python longs, on 64-bit platforms. | Mark Dickinson | 2009-03-20 | 1 | -0/+49 |
| | | | | Backport of r70459. | ||||
* | Replace long with twodigits, to avoid depending | Mark Dickinson | 2009-02-25 | 1 | -1/+1 |
| | | | | on sizeof(digit) < sizeof(long) | ||||
* | A few more minor fixes in longobject.c | Mark Dickinson | 2009-02-15 | 1 | -5/+4 |
| | |||||
* | Issue #5260: Various portability and standards compliance fixes, optimizations | Mark Dickinson | 2009-02-15 | 1 | -46/+35 |
| | | | | | | | and cleanups in Objects/longobject.c. The most significant change is that longs now use less memory: average savings are 2 bytes per long on 32-bit systems and 6 bytes per long on 64-bit systems. (This memory saving already exists in py3k.) | ||||
* | Issue #5175: PyLong_AsUnsignedLongLong now raises OverflowError for | Mark Dickinson | 2009-02-10 | 1 | -1/+1 |
| | | | | | | negative arguments. Previously, it raised TypeError. Thanks Lisandro Dalcin. | ||||
* | Fix comment. | Mark Dickinson | 2009-01-26 | 1 | -3/+3 |
| | |||||
* | Fix undefined behaviour (left shift of negative value) in long_hash. Also, | Mark Dickinson | 2009-01-26 | 1 | -9/+10 |
| | | | | rewrap a line of length > 79, and update comments. | ||||
* | No need for carry to be type twodigits in _PyLong_AsByteArray; digit is ↵ | Mark Dickinson | 2009-01-25 | 1 | -1/+1 |
| | | | | | | large enough. This change should silence a compiler warning on Windows. | ||||
* | Issue #4393: fix 3 classes of potential portability problems in longobject.c: | Mark Dickinson | 2009-01-24 | 1 | -23/+20 |
| | | | | | | | - fix some places where counters into ob_digit were declared as int instead of Py_ssize_t - add (twodigit) casts where necessary - fix code in _PyLong_AsByteArray that uses << on negative values | ||||
* | Issue #3439: add bit_length method to int and long. | Mark Dickinson | 2008-12-17 | 1 | -0/+71 |
| | | | | | Thanks Fredrik Johansson and Victor Stinner for code, Raymond Hettinger for review. | ||||
* | Issue #1481296: (again!) Make conversion of a float NaN to an int or | Mark Dickinson | 2008-08-04 | 1 | -2/+4 |
| | | | | | | | long raise ValueError instead of returning 0. Also, change the error message for conversion of an infinity to an integer, replacing 'long' by 'integer', so that it's appropriate for both long(float('inf')) and int(float('inf')). | ||||
* | Security patches from Apple: prevent int overflow when allocating memory | Neal Norwitz | 2008-07-31 | 1 | -0/+2 |
| | |||||
* | Added additional __sizeof__ implementations and addressed comments made in | Robert Schuppenies | 2008-07-10 | 1 | -2/+2 |
| | | | | Issue3122. | ||||
* | Revert 64424, 64438, and 64439. | Raymond Hettinger | 2008-06-24 | 1 | -7/+0 |
| | |||||
* | Make bin() implementation parallel oct() and hex() so that int/long ↵ | Raymond Hettinger | 2008-06-20 | 1 | -0/+7 |
| | | | | subclasses can override or so that other classes can support. | ||||
* | This reverts r63675 based on the discussion in this thread: | Gregory P. Smith | 2008-06-09 | 1 | -16/+16 |
| | | | | | | | http://mail.python.org/pipermail/python-dev/2008-June/079988.html Python 2.6 should stick with PyString_* in its codebase. The PyBytes_* names in the spirit of 3.0 are available via a #define only. See the email thread. | ||||
* | Some style nits. Also clarify in the docstrings what __sizeof__ does. | Georg Brandl | 2008-06-01 | 1 | -1/+1 |
| | |||||
* | Issue #2898: Added sys.getsizeof() to retrieve size of objects in bytes. | Robert Schuppenies | 2008-06-01 | 1 | -0/+13 |
| | |||||
* | Refactor and clean up str.format() code (and helpers) in advance of ↵ | Eric Smith | 2008-05-30 | 1 | -16/+11 |
| | | | | optimizations. | ||||
* | Renamed PyString to PyBytes | Christian Heimes | 2008-05-26 | 1 | -17/+17 |
| | |||||
* | I finally got the time to update and merge Mark's and my trunk-math branch. ↵ | Christian Heimes | 2008-04-18 | 1 | -0/+12 |
| | | | | | | The patch is collaborated work of Mark Dickinson and me. It was mostly done a few months ago. The patch fixes a lot of loose ends and edge cases related to operations with NaN, INF, very small values and complex math. The patch also adds acosh, asinh, atanh, log1p and copysign to all platforms. Finally it fixes differences between platforms like different results or exceptions for edge cases. Have fun :) | ||||
* | Fix for possible signed overflow: the behaviour of -LONG_MIN is | Mark Dickinson | 2008-04-15 | 1 | -6/+19 |
| | | | | undefined in ANSI C. | ||||
* | Revert r61969 which added casts to Py_CHARMASK to avoid compiler warnings. | Neal Norwitz | 2008-03-28 | 1 | -5/+5 |
| | | | | | | Rather than sprinkle casts throughout the code, change Py_CHARMASK to always cast it's result to an unsigned char. This should ensure we do the right thing when accessing an array with the result. |