@@ -79,9 +79,87 @@ static inline PyObject* _PyLong_FromUnsignedChar(unsigned char i)
7979 return (PyObject * )& _PyLong_SMALL_INTS [_PY_NSMALLNEGINTS + i ];
8080}
8181
82- extern PyObject * _PyLong_Add (PyLongObject * left , PyLongObject * right );
83- extern PyObject * _PyLong_Multiply (PyLongObject * left , PyLongObject * right );
84- extern PyObject * _PyLong_Subtract (PyLongObject * left , PyLongObject * right );
82+ // _PyLong_Frexp returns a double x and an exponent e such that the
83+ // true value is approximately equal to x * 2**e. e is >= 0. x is
84+ // 0.0 if and only if the input is 0 (in which case, e and x are both
85+ // zeroes); otherwise, 0.5 <= abs(x) < 1.0. On overflow, which is
86+ // possible if the number of bits doesn't fit into a Py_ssize_t, sets
87+ // OverflowError and returns -1.0 for x, 0 for e.
88+ //
89+ // Export for 'math' shared extension
90+ PyAPI_DATA (double ) _PyLong_Frexp (PyLongObject * a , Py_ssize_t * e );
91+
92+ extern PyObject * _PyLong_FromBytes (const char * , Py_ssize_t , int );
93+
94+ // _PyLong_DivmodNear. Given integers a and b, compute the nearest
95+ // integer q to the exact quotient a / b, rounding to the nearest even integer
96+ // in the case of a tie. Return (q, r), where r = a - q*b. The remainder r
97+ // will satisfy abs(r) <= abs(b)/2, with equality possible only if q is
98+ // even.
99+ //
100+ // Export for '_datetime' shared extension.
101+ PyAPI_DATA (PyObject * ) _PyLong_DivmodNear (PyObject * , PyObject * );
102+
103+ // _PyLong_FromByteArray: View the n unsigned bytes as a binary integer in
104+ // base 256, and return a Python int with the same numeric value.
105+ // If n is 0, the integer is 0. Else:
106+ // If little_endian is 1/true, bytes[n-1] is the MSB and bytes[0] the LSB;
107+ // else (little_endian is 0/false) bytes[0] is the MSB and bytes[n-1] the
108+ // LSB.
109+ // If is_signed is 0/false, view the bytes as a non-negative integer.
110+ // If is_signed is 1/true, view the bytes as a 2's-complement integer,
111+ // non-negative if bit 0x80 of the MSB is clear, negative if set.
112+ // Error returns:
113+ // + Return NULL with the appropriate exception set if there's not
114+ // enough memory to create the Python int.
115+ //
116+ // Export for '_multibytecodec' shared extension.
117+ PyAPI_DATA (PyObject * ) _PyLong_FromByteArray (
118+ const unsigned char * bytes , size_t n ,
119+ int little_endian , int is_signed );
120+
121+ // _PyLong_AsByteArray: Convert the least-significant 8*n bits of long
122+ // v to a base-256 integer, stored in array bytes. Normally return 0,
123+ // return -1 on error.
124+ // If little_endian is 1/true, store the MSB at bytes[n-1] and the LSB at
125+ // bytes[0]; else (little_endian is 0/false) store the MSB at bytes[0] and
126+ // the LSB at bytes[n-1].
127+ // If is_signed is 0/false, it's an error if v < 0; else (v >= 0) n bytes
128+ // are filled and there's nothing special about bit 0x80 of the MSB.
129+ // If is_signed is 1/true, bytes is filled with the 2's-complement
130+ // representation of v's value. Bit 0x80 of the MSB is the sign bit.
131+ // Error returns (-1):
132+ // + is_signed is 0 and v < 0. TypeError is set in this case, and bytes
133+ // isn't altered.
134+ // + n isn't big enough to hold the full mathematical value of v. For
135+ // example, if is_signed is 0 and there are more digits in the v than
136+ // fit in n; or if is_signed is 1, v < 0, and n is just 1 bit shy of
137+ // being large enough to hold a sign bit. OverflowError is set in this
138+ // case, but bytes holds the least-significant n bytes of the true value.
139+ //
140+ // Export for '_struct' shared extension.
141+ PyAPI_DATA (int ) _PyLong_AsByteArray (PyLongObject * v ,
142+ unsigned char * bytes , size_t n ,
143+ int little_endian , int is_signed );
144+
145+ // _PyLong_Format: Convert the long to a string object with given base,
146+ // appending a base prefix of 0[box] if base is 2, 8 or 16.
147+ // Export for '_tkinter' shared extension.
148+ PyAPI_DATA (PyObject * ) _PyLong_Format (PyObject * obj , int base );
149+
150+ // For use by the math.gcd() function.
151+ // Export for 'math' shared extension.
152+ PyAPI_DATA (PyObject * ) _PyLong_GCD (PyObject * , PyObject * );
153+
154+ // Export for 'math' shared extension
155+ PyAPI_DATA (PyObject * ) _PyLong_Rshift (PyObject * , size_t );
156+
157+ // Export for 'math' shared extension
158+ PyAPI_DATA (PyObject * ) _PyLong_Lshift (PyObject * , size_t );
159+
160+ extern PyObject * _PyLong_Add (PyLongObject * left , PyLongObject * right );
161+ extern PyObject * _PyLong_Multiply (PyLongObject * left , PyLongObject * right );
162+ extern PyObject * _PyLong_Subtract (PyLongObject * left , PyLongObject * right );
85163
86164// Export for 'binascii' shared extension.
87165PyAPI_DATA (unsigned char ) _PyLong_DigitValue [256 ];
0 commit comments