summaryrefslogtreecommitdiffstats
path: root/Include/cpython/longintrepr.h
Commit message (Collapse)AuthorAgeFilesLines
* gh-116869: Make C API compatible with ISO C90 (#116950)Victor Stinner2024-03-181-1/+2
| | | | Make the C API compatible with -Werror=declaration-after-statement compiler flag again.
* gh-113706: Update comment about long int representation (#113707)Michael Droettboom2024-02-261-10/+21
|
* gh-112026: Restore removed private C API (#112115)Victor Stinner2023-11-151-0/+10
| | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | | Restore removed private C API functions, macros and structures which have no simple replacement for now: * _PyDict_GetItem_KnownHash() * _PyDict_NewPresized() * _PyHASH_BITS * _PyHASH_IMAG * _PyHASH_INF * _PyHASH_MODULUS * _PyHASH_MULTIPLIER * _PyLong_Copy() * _PyLong_FromDigits() * _PyLong_New() * _PyLong_Sign() * _PyObject_CallMethodId() * _PyObject_CallMethodNoArgs() * _PyObject_CallMethodOneArg() * _PyObject_CallOneArg() * _PyObject_EXTRA_INIT * _PyObject_FastCallDict() * _PyObject_GetAttrId() * _PyObject_Vectorcall() * _PyObject_VectorcallMethod() * _PyStack_AsDict() * _PyThread_CurrentFrames() * _PyUnicodeWriter structure * _PyUnicodeWriter_Dealloc() * _PyUnicodeWriter_Finish() * _PyUnicodeWriter_Init() * _PyUnicodeWriter_Prepare() * _PyUnicodeWriter_PrepareKind() * _PyUnicodeWriter_WriteASCIIString() * _PyUnicodeWriter_WriteChar() * _PyUnicodeWriter_WriteLatin1String() * _PyUnicodeWriter_WriteStr() * _PyUnicodeWriter_WriteSubstring() * _PyUnicode_AsString() * _PyUnicode_FromId() * _PyVectorcall_Function() * _Py_HashDouble() * _Py_HashPointer() * _Py_IDENTIFIER() * _Py_c_abs() * _Py_c_diff() * _Py_c_neg() * _Py_c_pow() * _Py_c_prod() * _Py_c_quot() * _Py_c_sum() * _Py_static_string() * _Py_static_string_init()
* gh-106320: Remove private _PyLong_New() function (#108604)Victor Stinner2023-08-291-8/+0
| | | | | | | | | Move the following private API to the internal C API (pycore_long.h): * _PyLong_Copy() * _PyLong_FromDigits() * _PyLong_New() No longer export most of these functions.
* GH-101291: Avoid using macros with casts in low-level long API. (#104742)Mark Shannon2023-05-221-2/+3
|
* 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.