123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103 |
- #ifndef Py_LONGINTREPR_H
- #define Py_LONGINTREPR_H
- #ifdef __cplusplus
- extern "C" {
- #endif
- #if PYLONG_BITS_IN_DIGIT == 30
- #if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \
- defined HAVE_INT64_T && defined HAVE_INT32_T)
- #error "30-bit long digits requested, but the necessary types are not available on this platform"
- #endif
- typedef PY_UINT32_T digit;
- typedef PY_INT32_T sdigit;
- typedef PY_UINT64_T twodigits;
- typedef PY_INT64_T stwodigits;
- #define PyLong_SHIFT 30
- #define _PyLong_DECIMAL_SHIFT 9
- #define _PyLong_DECIMAL_BASE ((digit)1000000000)
- #elif PYLONG_BITS_IN_DIGIT == 15
- typedef unsigned short digit;
- typedef short sdigit;
- typedef unsigned long twodigits;
- typedef long stwodigits;
- #define PyLong_SHIFT 15
- #define _PyLong_DECIMAL_SHIFT 4
- #define _PyLong_DECIMAL_BASE ((digit)10000)
- #else
- #error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
- #endif
- #define PyLong_BASE ((digit)1 << PyLong_SHIFT)
- #define PyLong_MASK ((digit)(PyLong_BASE - 1))
- #define SHIFT PyLong_SHIFT
- #define BASE PyLong_BASE
- #define MASK PyLong_MASK
- #if PyLong_SHIFT % 5 != 0
- #error "longobject.c requires that PyLong_SHIFT be divisible by 5"
- #endif
- struct _longobject {
- PyObject_VAR_HEAD
- digit ob_digit[1];
- };
- PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
- PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
- #ifdef __cplusplus
- }
- #endif
- #endif
|