summaryrefslogtreecommitdiffstats
path: root/Include/cpython/longintrepr.h
Commit message (Collapse)AuthorAgeFilesLines
* [3.12] gh-116869: Make C API compatible with ISO C90 (GH-116950) (#117011)Miss Islington (bot)2024-03-191-1/+2
| | | | | | | | | gh-116869: Make C API compatible with ISO C90 (GH-116950) Make the C API compatible with -Werror=declaration-after-statement compiler flag again. (cherry picked from commit a9c304cf020e2fa3ae78fd88359dfc808c9dd639) Co-authored-by: Victor Stinner <vstinner@python.org>
* [3.12] GH-101291: Avoid using macros with casts in low-level long API. ↵Miss Islington (bot)2023-05-231-2/+3
| | | | | | | (GH-104742) (#104759) (cherry picked from commit e295d8605699ad3d8ec46c8d55a5e47da05b20c6) Co-authored-by: Mark Shannon <mark@hotpy.org>
* GH-101291: Add low level, unstable API for pylong (GH-101685)Mark Shannon2023-05-211-0/+26
| | | Co-authored-by: Petr Viktorin <encukou@gmail.com>
* GH-101291: Rearrange the size bits in PyLongObject (GH-102464)Mark Shannon2023-03-221-1/+5
| | | | | | | | | | * Eliminate all remaining uses of Py_SIZE and Py_SET_SIZE on PyLongObject, adding asserts. * Change layout of size/sign bits in longobject to support future addition of immortal ints and tagged medium ints. * Add functions to hide some internals of long object, and for setting sign and digit count. * Replace uses of IS_MEDIUM_VALUE macro with _PyLong_IsCompact().
* GH-101291: Refactor the `PyLongObject` struct into object header and ↵Mark Shannon2023-01-301-2/+7
| | | | PyLongValue struct. (GH-101292)
* gh-101037: Fix potential memory underallocation for zeros of int subtypes ↵Mark Dickinson2023-01-211-0/+3
| | | | | | | | | (#101038) This PR fixes object allocation in long_subtype_new to ensure that there's at least one digit in all cases, and makes sure that the value of that digit is copied over from the source long. Needs backport to 3.11, but not any further: the change to require at least one digit was only introduced for Python 3.11. Fixes #101037.
* bpo-46218: Change long_pow() to sliding window algorithm (GH-30319)Tim Peters2022-01-021-6/+0
| | | | | | | | | | | * bpo-46218: Change long_pow() to sliding window algorithm The primary motivation is to eliminate long_pow's reliance on that the number of bits in a long "digit" is a multiple of 5. Now it no longer cares how many bits are in a digit. But the sliding window approach also allows cutting the precomputed table of small powers in half, which reduces initialization overhead enough that the approach pays off for smaller exponents too. Depending on exponent bit patterns, a sliding window may also be able to save some bigint multiplies (sometimes when at least 5 consecutive exponent bits are 0, regardless of their starting bit position modulo 5). Note: boosting the window width to 6 didn't work well overall. It give marginal speed improvements for huge exponents, but the increased overhead (the small-power table needs twice as many entries) made it a loss for smaller exponents. Co-authored-by: Oleg Iarygin <dralife@yandex.ru>
* bpo-35134: Move classobject.h to Include/cpython/ (GH-28968)Victor Stinner2021-10-151-0/+99
Move classobject.h, context.h, genobject.h and longintrepr.h header files from Include/ to Include/cpython/. Remove redundant "#ifndef Py_LIMITED_API" in context.h. Remove explicit #include "longintrepr.h" in C files. It's not needed, Python.h already includes it.