| #ifndef Py_INTERNAL_LONG_H |
| #define Py_INTERNAL_LONG_H |
| #ifdef __cplusplus |
| extern "C" { |
| #endif |
|
|
| #ifndef Py_BUILD_CORE |
| # error "this header requires Py_BUILD_CORE define" |
| #endif |
|
|
| #include "pycore_global_objects.h" |
| #include "pycore_runtime.h" |
|
|
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define _PY_LONG_DEFAULT_MAX_STR_DIGITS 4300 |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| |
| #define _PY_LONG_MAX_STR_DIGITS_THRESHOLD 640 |
|
|
| #if ((_PY_LONG_DEFAULT_MAX_STR_DIGITS != 0) && \ |
| (_PY_LONG_DEFAULT_MAX_STR_DIGITS < _PY_LONG_MAX_STR_DIGITS_THRESHOLD)) |
| # error "_PY_LONG_DEFAULT_MAX_STR_DIGITS smaller than threshold." |
| #endif |
|
|
|
|
| |
|
|
| extern PyStatus _PyLong_InitTypes(PyInterpreterState *); |
| extern void _PyLong_FiniTypes(PyInterpreterState *interp); |
|
|
|
|
| |
|
|
| #define _PyLong_SMALL_INTS _Py_SINGLETON(small_ints) |
|
|
| |
| |
| #if _PY_NSMALLPOSINTS < 257 |
| # error "_PY_NSMALLPOSINTS must be greater than or equal to 257" |
| #endif |
|
|
| |
| |
| static inline PyObject* _PyLong_GetZero(void) |
| { return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS]; } |
|
|
| |
| |
| static inline PyObject* _PyLong_GetOne(void) |
| { return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+1]; } |
|
|
| static inline PyObject* _PyLong_FromUnsignedChar(unsigned char i) |
| { |
| return Py_NewRef((PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+i]); |
| } |
|
|
| PyObject *_PyLong_Add(PyLongObject *left, PyLongObject *right); |
| PyObject *_PyLong_Multiply(PyLongObject *left, PyLongObject *right); |
| PyObject *_PyLong_Subtract(PyLongObject *left, PyLongObject *right); |
|
|
| |
| |
| PyAPI_DATA(unsigned char) _PyLong_DigitValue[256]; |
|
|
| |
| |
| PyAPI_FUNC(int) _PyLong_FormatAdvancedWriter( |
| _PyUnicodeWriter *writer, |
| PyObject *obj, |
| PyObject *format_spec, |
| Py_ssize_t start, |
| Py_ssize_t end); |
|
|
| PyAPI_FUNC(int) _PyLong_FormatWriter( |
| _PyUnicodeWriter *writer, |
| PyObject *obj, |
| int base, |
| int alternate); |
|
|
| PyAPI_FUNC(char*) _PyLong_FormatBytesWriter( |
| _PyBytesWriter *writer, |
| char *str, |
| PyObject *obj, |
| int base, |
| int alternate); |
|
|
| #ifdef __cplusplus |
| } |
| #endif |
| #endif |
|
|