Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 8 additions & 0 deletions Include/internal/pycore_long.h
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,14 @@ static inline PyObject* _PyLong_FromUnsignedChar(unsigned char i)
return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+i];
}

// Return a reference to the cached small int singleton.
// The caller must ensure -_PY_NSMALLNEGINTS <= value < _PY_NSMALLPOSINTS.
static inline PyObject* _PyLong_GetSmallInt(Py_ssize_t value)
{
assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS);
return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + (int)value];
}

// _PyLong_Frexp returns a double x and an exponent e such that the
// true value is approximately equal to x * 2**e. x is
// 0.0 if and only if the input is 0 (in which case, e and x are both
Expand Down
Loading
Loading