Edit File by line
/home/barbar84/public_h.../wp-conte.../plugins/sujqvwi/ExeBy/smexe_ro.../usr/include/python3....
File: longintrepr.h
#ifndef Py_LIMITED_API
[0] Fix | Delete
#ifndef Py_LONGINTREPR_H
[1] Fix | Delete
#define Py_LONGINTREPR_H
[2] Fix | Delete
#ifdef __cplusplus
[3] Fix | Delete
extern "C" {
[4] Fix | Delete
#endif
[5] Fix | Delete
[6] Fix | Delete
[7] Fix | Delete
/* This is published for the benefit of "friends" marshal.c and _decimal.c. */
[8] Fix | Delete
[9] Fix | Delete
/* Parameters of the integer representation. There are two different
[10] Fix | Delete
sets of parameters: one set for 30-bit digits, stored in an unsigned 32-bit
[11] Fix | Delete
integer type, and one set for 15-bit digits with each digit stored in an
[12] Fix | Delete
unsigned short. The value of PYLONG_BITS_IN_DIGIT, defined either at
[13] Fix | Delete
configure time or in pyport.h, is used to decide which digit size to use.
[14] Fix | Delete
[15] Fix | Delete
Type 'digit' should be able to hold 2*PyLong_BASE-1, and type 'twodigits'
[16] Fix | Delete
should be an unsigned integer type able to hold all integers up to
[17] Fix | Delete
PyLong_BASE*PyLong_BASE-1. x_sub assumes that 'digit' is an unsigned type,
[18] Fix | Delete
and that overflow is handled by taking the result modulo 2**N for some N >
[19] Fix | Delete
PyLong_SHIFT. The majority of the code doesn't care about the precise
[20] Fix | Delete
value of PyLong_SHIFT, but there are some notable exceptions:
[21] Fix | Delete
[22] Fix | Delete
- long_pow() requires that PyLong_SHIFT be divisible by 5
[23] Fix | Delete
[24] Fix | Delete
- PyLong_{As,From}ByteArray require that PyLong_SHIFT be at least 8
[25] Fix | Delete
[26] Fix | Delete
- long_hash() requires that PyLong_SHIFT is *strictly* less than the number
[27] Fix | Delete
of bits in an unsigned long, as do the PyLong <-> long (or unsigned long)
[28] Fix | Delete
conversion functions
[29] Fix | Delete
[30] Fix | Delete
- the Python int <-> size_t/Py_ssize_t conversion functions expect that
[31] Fix | Delete
PyLong_SHIFT is strictly less than the number of bits in a size_t
[32] Fix | Delete
[33] Fix | Delete
- the marshal code currently expects that PyLong_SHIFT is a multiple of 15
[34] Fix | Delete
[35] Fix | Delete
- NSMALLNEGINTS and NSMALLPOSINTS should be small enough to fit in a single
[36] Fix | Delete
digit; with the current values this forces PyLong_SHIFT >= 9
[37] Fix | Delete
[38] Fix | Delete
The values 15 and 30 should fit all of the above requirements, on any
[39] Fix | Delete
platform.
[40] Fix | Delete
*/
[41] Fix | Delete
[42] Fix | Delete
#if PYLONG_BITS_IN_DIGIT == 30
[43] Fix | Delete
typedef uint32_t digit;
[44] Fix | Delete
typedef int32_t sdigit; /* signed variant of digit */
[45] Fix | Delete
typedef uint64_t twodigits;
[46] Fix | Delete
typedef 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
#if PyLong_SHIFT % 5 != 0
[65] Fix | Delete
#error "longobject.c requires that PyLong_SHIFT be divisible by 5"
[66] Fix | Delete
#endif
[67] Fix | Delete
[68] Fix | Delete
/* Long integer representation.
[69] Fix | Delete
The absolute value of a number is equal to
[70] Fix | Delete
SUM(for i=0 through abs(ob_size)-1) ob_digit[i] * 2**(SHIFT*i)
[71] Fix | Delete
Negative numbers are represented with ob_size < 0;
[72] Fix | Delete
zero is represented by ob_size == 0.
[73] Fix | Delete
In a normalized number, ob_digit[abs(ob_size)-1] (the most significant
[74] Fix | Delete
digit) is never zero. Also, in all cases, for all valid i,
[75] Fix | Delete
0 <= ob_digit[i] <= MASK.
[76] Fix | Delete
The allocation function takes care of allocating extra memory
[77] Fix | Delete
so that ob_digit[0] ... ob_digit[abs(ob_size)-1] are actually available.
[78] Fix | Delete
[79] Fix | Delete
CAUTION: Generic code manipulating subtypes of PyVarObject has to
[80] Fix | Delete
aware that ints abuse ob_size's sign bit.
[81] Fix | Delete
*/
[82] Fix | Delete
[83] Fix | Delete
struct _longobject {
[84] Fix | Delete
PyObject_VAR_HEAD
[85] Fix | Delete
digit ob_digit[1];
[86] Fix | Delete
};
[87] Fix | Delete
[88] Fix | Delete
PyAPI_FUNC(PyLongObject *) _PyLong_New(Py_ssize_t);
[89] Fix | Delete
[90] Fix | Delete
/* Return a copy of src. */
[91] Fix | Delete
PyAPI_FUNC(PyObject *) _PyLong_Copy(PyLongObject *src);
[92] Fix | Delete
[93] Fix | Delete
#ifdef __cplusplus
[94] Fix | Delete
}
[95] Fix | Delete
#endif
[96] Fix | Delete
#endif /* !Py_LONGINTREPR_H */
[97] Fix | Delete
#endif /* Py_LIMITED_API */
[98] Fix | Delete
[99] Fix | Delete
It is recommended that you Edit text format, this type of Fix handles quite a lot in one request
Function