mirror of
https://github.com/python/cpython.git
synced 2025-09-28 19:25:27 +00:00
Merge branch 'main' of https://github.com/python/cpython into main
This commit is contained in:
commit
2c4e29e322
2 changed files with 3 additions and 9 deletions
|
@ -6,13 +6,6 @@
|
||||||
|
|
||||||
:Author: `Michael Foord <https://agileabstractions.com/>`_
|
:Author: `Michael Foord <https://agileabstractions.com/>`_
|
||||||
|
|
||||||
.. note::
|
|
||||||
|
|
||||||
There is a French translation of an earlier revision of this
|
|
||||||
HOWTO, available at `urllib2 - Le Manuel manquant
|
|
||||||
<https://web.archive.org/web/20200910051922/http://www.voidspace.org.uk/python/articles/urllib2_francais.shtml>`_.
|
|
||||||
|
|
||||||
|
|
||||||
|
|
||||||
Introduction
|
Introduction
|
||||||
============
|
============
|
||||||
|
|
|
@ -104,9 +104,10 @@ _PyLong_FromDigits(int negative, Py_ssize_t digit_count, digit *digits);
|
||||||
#define _PyLong_SIGN_MASK 3
|
#define _PyLong_SIGN_MASK 3
|
||||||
#define _PyLong_NON_SIZE_BITS 3
|
#define _PyLong_NON_SIZE_BITS 3
|
||||||
|
|
||||||
|
|
||||||
static inline int
|
static inline int
|
||||||
_PyLong_IsCompact(const PyLongObject* op) {
|
_PyLong_IsCompact(const PyLongObject* op) {
|
||||||
assert(PyLong_Check(op));
|
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
|
||||||
return op->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS);
|
return op->long_value.lv_tag < (2 << _PyLong_NON_SIZE_BITS);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
@ -115,7 +116,7 @@ _PyLong_IsCompact(const PyLongObject* op) {
|
||||||
static inline Py_ssize_t
|
static inline Py_ssize_t
|
||||||
_PyLong_CompactValue(const PyLongObject *op)
|
_PyLong_CompactValue(const PyLongObject *op)
|
||||||
{
|
{
|
||||||
assert(PyLong_Check(op));
|
assert(PyType_HasFeature((op)->ob_base.ob_type, Py_TPFLAGS_LONG_SUBCLASS));
|
||||||
assert(PyUnstable_Long_IsCompact(op));
|
assert(PyUnstable_Long_IsCompact(op));
|
||||||
Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
|
Py_ssize_t sign = 1 - (op->long_value.lv_tag & _PyLong_SIGN_MASK);
|
||||||
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
|
return sign * (Py_ssize_t)op->long_value.ob_digit[0];
|
||||||
|
|
Loading…
Add table
Add a link
Reference in a new issue