Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ShExBy/shex_roo.../usr/include/python2....
File: longintrepr.h
#ifndef Py_LONGINTREPR_H
[0] Fix | Delete
#define Py_LONGINTREPR_H
[1] Fix | Delete
#ifdef __cplusplus
[2] Fix | Delete
extern "C" {
[3] Fix | Delete
#endif
[4] Fix | Delete
[5] Fix | Delete
[6] Fix | Delete
/* This is published for the benefit of "friend" marshal.c only. */
[7] Fix | Delete
[8] Fix | Delete
/* Parameters of the long integer representation. There are two different
[9] Fix | Delete
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
[10] Fix | Delete
integer type, and one set for 15-bit digits with each digit stored in an
[11] Fix | Delete
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
[12] Fix | Delete
configure time or in pyport.h, is used to decide which digit size to use.
[13] Fix | Delete
[14] Fix | Delete
Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
[15] Fix | Delete
should be an unsigned integer type able to hold all integers up to
[16] Fix | Delete
PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,
[17] Fix | Delete
and that overflow is handled by taking the result modulo 2**N for some N >
[18] Fix | Delete
PyLong_SHIFT. The majority of the code doesn't care about the precise
[19] Fix | Delete
value of PyLong_SHIFT, but there are some notable exceptions:
[20] Fix | Delete
[21] Fix | Delete
- long_pow() requires that PyLong_SHIFT be divisible by 5
[22] Fix | Delete
[23] Fix | Delete
- PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
[24] Fix | Delete
[25] Fix | Delete
- long_hash() requires that PyLong_SHIFT is *strictly* less than the number
[26] Fix | Delete
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
[27] Fix | Delete
conversion functions
[28] Fix | Delete
[29] Fix | Delete
- the long <-> size_t/Py_ssize_t conversion functions expect that
[30] Fix | Delete
PyLong_SHIFT is strictly less than the number of bits in a size_t
[31] Fix | Delete
[32] Fix | Delete
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
[33] Fix | Delete
[34] Fix | Delete
The values 15 and 30 should fit all of the above requirements, on any
[35] Fix | Delete
platform.
[36] Fix | Delete
*/
[37] Fix | Delete
[38] Fix | Delete
#if PYLONG_BITS_IN_DIGIT == 30
[39] Fix | Delete
#if !(defined HAVE_UINT64_T && defined HAVE_UINT32_T && \
[40] Fix | Delete
defined HAVE_INT64_T && defined HAVE_INT32_T)
[41] Fix | Delete
#error "30-bit long digits requested, but the necessary types are not available on this platform"
[42] Fix | Delete
#endif
[43] Fix | Delete
typedef PY_UINT32_T digit;
[44] Fix | Delete
typedef PY_INT32_T sdigit; /* signed variant of digit */
[45] Fix | Delete
typedef PY_UINT64_T twodigits;
[46] Fix | Delete
typedef PY_INT64_T stwodigits; /* signed variant of twodigits */
[47] Fix | Delete
#define PyLong_SHIFT 30
[48] Fix | Delete
#define _PyLong_DECIMAL_SHIFT 9 /* max(e such that 10**e fits in a digit) */
[49] Fix | Delete
#define _PyLong_DECIMAL_BASE ((digit)1000000000) /* 10 ** DECIMAL_SHIFT */
[50] Fix | Delete
#elif PYLONG_BITS_IN_DIGIT == 15
[51] Fix | Delete
typedef unsigned short digit;
[52] Fix | Delete
typedef short sdigit; /* signed variant of digit */
[53] Fix | Delete
typedef unsigned long twodigits;
[54] Fix | Delete
typedef long stwodigits; /* signed variant of twodigits */
[55] Fix | Delete
#define PyLong_SHIFT 15
[56] Fix | Delete
#define _PyLong_DECIMAL_SHIFT 4 /* max(e such that 10**e fits in a digit) */
[57] Fix | Delete
#define _PyLong_DECIMAL_BASE ((digit)10000) /* 10 ** DECIMAL_SHIFT */
[58] Fix | Delete
#else
[59] Fix | Delete
#error "PYLONG_BITS_IN_DIGIT should be 15 or 30"
[60] Fix | Delete
#endif
[61] Fix | Delete
#define PyLong_BASE ((digit)1 << PyLong_SHIFT)
[62] Fix | Delete
#define PyLong_MASK ((digit)(PyLong_BASE - 1))
[63] Fix | Delete
[64] Fix | Delete
/* b/w compatibility with Python 2.5 */
[65] Fix | Delete
#define SHIFT PyLong_SHIFT
[66] Fix | Delete
#define BASE PyLong_BASE
[67] Fix | Delete
#define MASK PyLong_MASK
[68] Fix | Delete
[69] Fix | Delete
#if PyLong_SHIFT % 5 != 0
[70] Fix | Delete
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
[71] Fix | Delete
#endif
[72] Fix | Delete
[73] Fix | Delete
/* Long integer representation.
[74] Fix | Delete
The absolute value of a number is equal to
[75] Fix | Delete
SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
[76] Fix | Delete
Negative numbers are represented with ob_size < 0;
[77] Fix | Delete
zero is represented by ob_size == 0.
[78] Fix | Delete
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
[79] Fix | Delete
digit) is never zero. Also, in all cases, for all valid i,
[80] Fix | Delete
0 <= ob_digit[i] <= MASK.
[81] Fix | Delete
The allocation function takes care of allocating extra memory
[82] Fix | Delete
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
[83] Fix | Delete
[84] Fix | Delete
CAUTION: Generic code manipulating subtypes of PyVarObject has to
[85] Fix | Delete
aware that longs abuse ob_size's sign bit.
[86] Fix | Delete
*/
[87] Fix | Delete
[88] Fix | Delete
struct _longobject {
[89] Fix | Delete
PyObject_VAR_HEAD
[90] Fix | Delete
digit ob_digit[1];
[91] Fix | Delete
};
[92] Fix | Delete
[93] Fix | Delete
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
[94] Fix | Delete
[95] Fix | Delete
/* Return a copy of src. */
[96] Fix | Delete
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
[97] Fix | Delete
[98] Fix | Delete
#ifdef __cplusplus
[99] Fix | Delete
}
[100] Fix | Delete
#endif
[101] Fix | Delete
#endif /* !Py_LONGINTREPR_H */
[102] Fix | Delete
[103] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function