+++ /dev/null
-#ifndef Py_LONGINTREPR_H\r
-#define Py_LONGINTREPR_H\r
-#ifdef __cplusplus\r
-extern "C" {\r
-#endif\r
-\r
-\r
-/* This is published for the benefit of "friend" marshal.c only. */\r
-\r
-/* Parameters of the long integer representation. There are two different\r
- sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit\r
- integer type, and one set for 15-bit digits with each digit stored in an\r
- unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at\r
- configure time or in pyport.h, is used to decide which digit size to use.\r
-\r
- Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'\r
- should be an unsigned integer type able to hold all integers up to\r
- PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,\r
- and that overflow is handled by taking the result modulo 2**N for some N >\r
- PyLong_SHIFT. The majority of the code doesn't care about the precise\r
- value of PyLong_SHIFT, but there are some notable exceptions:\r
-\r
- - long_pow() requires that PyLong_SHIFT be divisible by 5\r
-\r
- - PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8\r
-\r
- - long_hash() requires that PyLong_SHIFT is *strictly* less than the number\r
- of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)\r
- conversion functions\r
-\r
- - the long <-> size_t/Py_ssize_t conversion functions expect that\r
- PyLong_SHIFT is strictly less than the number of bits in a size_t\r
-\r
- - the marshal code currently expects that PyLong_SHIFT is a multiple of 15\r
-\r
- The values 15 and 30 should fit all of the above requirements, on any\r
- platform.\r
-*/\r
-\r
-#if PYLONG_BITS_IN_DIGIT == 30\r
-#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \\r
- defined HAVE_INT64_T && defined HAVE_INT32_T)\r
-#error "30-bit long digits requested, but the necessary types are not available on this platform"\r
-#endif\r
-typedef PY_UINT32_T digit;\r
-typedef PY_INT32_T sdigit; /* signed variant of digit */\r
-typedef PY_UINT64_T twodigits;\r
-typedef PY_INT64_T stwodigits; /* signed variant of twodigits */\r
-#define PyLong_SHIFT 30\r
-#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */\r
-#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */\r
-#elif PYLONG_BITS_IN_DIGIT == 15\r
-typedef unsigned short digit;\r
-typedef short sdigit; /* signed variant of digit */\r
-typedef unsigned long twodigits;\r
-typedef long stwodigits; /* signed variant of twodigits */\r
-#define PyLong_SHIFT 15\r
-#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */\r
-#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */\r
-#else\r
-#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"\r
-#endif\r
-#define PyLong_BASE ((digit)1 << PyLong_SHIFT)\r
-#define PyLong_MASK ((digit)(PyLong_BASE - 1))\r
-\r
-/* b/w compatibility with Python 2.5 */\r
-#define SHIFT PyLong_SHIFT\r
-#define BASE PyLong_BASE\r
-#define MASK PyLong_MASK\r
-\r
-#if PyLong_SHIFT % 5 != 0\r
-#error "longobject.c requires that PyLong_SHIFT be divisible by 5"\r
-#endif\r
-\r
-/* Long integer representation.\r
- The absolute value of a number is equal to\r
- SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)\r
- Negative numbers are represented with ob_size < 0;\r
- zero is represented by ob_size == 0.\r
- In a normalized number, ob_digit[abs(ob_size)-1] (the most significant\r
- digit) is never zero. Also, in all cases, for all valid i,\r
- 0 <= ob_digit[i] <= MASK.\r
- The allocation function takes care of allocating extra memory\r
- so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.\r
-\r
- CAUTION: Generic code manipulating subtypes of PyVarObject has to\r
- aware that longs abuse ob_size's sign bit.\r
-*/\r
-\r
-struct _longobject {\r
- PyObject_VAR_HEAD\r
- digit ob_digit[1];\r
-};\r
-\r
-PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);\r
-\r
-/* Return a copy of src. */\r
-PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);\r
-\r
-#ifdef __cplusplus\r
-}\r
-#endif\r
-#endif /* !Py_LONGINTREPR_H */\r