Skip to content

Commit 60b81be

Browse files
committed
review comments
1 parent 7710226 commit 60b81be

File tree

2 files changed

+12
-18
lines changed

2 files changed

+12
-18
lines changed

Include/internal/pycore_long.h

Lines changed: 1 addition & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -82,13 +82,7 @@ static inline PyObject* _PyLong_FromUnsignedChar(unsigned char i)
8282
return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS+i];
8383
}
8484

85-
// Return a reference to the cached small int singleton.
86-
// The caller must ensure -_PY_NSMALLNEGINTS <= value < _PY_NSMALLPOSINTS.
87-
static inline PyObject* _PyLong_GetSmallInt(Py_ssize_t value)
88-
{
89-
assert(-_PY_NSMALLNEGINTS <= value && value < _PY_NSMALLPOSINTS);
90-
return (PyObject *)&_PyLong_SMALL_INTS[_PY_NSMALLNEGINTS + (int)value];
91-
}
85+
9286

9387
// _PyLong_Frexp returns a double x and an exponent e such that the
9488
// true value is approximately equal to x * 2**e. x is

Python/ceval_macros.h

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -577,24 +577,24 @@ gen_try_set_executing(PyGenObject *gen)
577577
#define INT_INPLACE_OP(left, right, TARGET, OP, FUNC) \
578578
_PyStackRef _int_inplace_res = PyStackRef_NULL; \
579579
do { \
580-
PyObject *_target_o = PyStackRef_AsPyObjectBorrow(TARGET); \
581-
if (_Py_IsImmortal(_target_o)) { \
580+
PyObject *target_o = PyStackRef_AsPyObjectBorrow(TARGET); \
581+
if (_Py_IsImmortal(target_o)) { \
582582
break; \
583583
} \
584-
assert(_PyObject_IsUniquelyReferenced(_target_o)); \
585-
Py_ssize_t _left_val = _PyLong_CompactValue( \
584+
assert(_PyObject_IsUniquelyReferenced(target_o)); \
585+
Py_ssize_t left_val = _PyLong_CompactValue( \
586586
(PyLongObject *)PyStackRef_AsPyObjectBorrow(left)); \
587-
Py_ssize_t _right_val = _PyLong_CompactValue( \
587+
Py_ssize_t right_val = _PyLong_CompactValue( \
588588
(PyLongObject *)PyStackRef_AsPyObjectBorrow(right)); \
589-
Py_ssize_t _result = _left_val OP _right_val; \
590-
if (!_PY_IS_SMALL_INT(_result) \
591-
&& ((twodigits)((stwodigits)_result) + PyLong_MASK \
589+
Py_ssize_t result = left_val OP right_val; \
590+
if (!_PY_IS_SMALL_INT(result) \
591+
&& ((twodigits)((stwodigits)result) + PyLong_MASK \
592592
< (twodigits)PyLong_MASK + PyLong_BASE)) \
593593
{ \
594594
_PyLong_SetSignAndDigitCount( \
595-
(PyLongObject *)_target_o, _result < 0 ? -1 : 1, 1); \
596-
((PyLongObject *)_target_o)->long_value.ob_digit[0] = \
597-
(digit)(_result < 0 ? -_result : _result); \
595+
(PyLongObject *)target_o, result < 0 ? -1 : 1, 1); \
596+
((PyLongObject *)target_o)->long_value.ob_digit[0] = \
597+
(digit)(result < 0 ? -result : result); \
598598
_int_inplace_res = PyStackRef_DUP(TARGET); \
599599
break; \
600600
} \

0 commit comments

Comments
 (0)