diff options
author | Sergey Fedoseev <fedoseev.sergey@gmail.com> | 2019-12-05 14:55:28 (GMT) |
---|---|---|
committer | Victor Stinner <vstinner@python.org> | 2019-12-05 14:55:28 (GMT) |
commit | 1f9f69dd4c5ee232c0b2f782933a89359932a67f (patch) | |
tree | 1073e7f75e4986754a2805cd0103767d988a7612 /Objects | |
parent | 99eb70a9eb9493602ff6ad8bb92df4318cf05a3e (diff) | |
download | cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.zip cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.tar.gz cpython-1f9f69dd4c5ee232c0b2f782933a89359932a67f.tar.bz2 |
bpo-27961: Replace PY_LLONG_MAX, PY_LLONG_MIN and PY_ULLONG_MAX with standard macros (GH-15385)
Use standard constants LLONG_MIN, LLONG_MAX and ULLONG_MAX.
Diffstat (limited to 'Objects')
-rw-r--r-- | Objects/longobject.c | 10 |
1 files changed, 5 insertions, 5 deletions
diff --git a/Objects/longobject.c b/Objects/longobject.c index f056797..bc87fb2 100644 --- a/Objects/longobject.c +++ b/Objects/longobject.c @@ -1158,7 +1158,7 @@ PyLong_AsVoidPtr(PyObject *vv) * rewritten to use the newer PyLong_{As,From}ByteArray API. */ -#define PY_ABS_LLONG_MIN (0-(unsigned long long)PY_LLONG_MIN) +#define PY_ABS_LLONG_MIN (0-(unsigned long long)LLONG_MIN) /* Create a new int object from a C long long int. */ @@ -1462,11 +1462,11 @@ PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow) /* Haven't lost any bits, but casting to long requires extra * care (see comment above). */ - if (x <= (unsigned long long)PY_LLONG_MAX) { + if (x <= (unsigned long long)LLONG_MAX) { res = (long long)x * sign; } else if (sign < 0 && x == PY_ABS_LLONG_MIN) { - res = PY_LLONG_MIN; + res = LLONG_MIN; } else { *overflow = sign; @@ -5020,7 +5020,7 @@ simple: /* a fits into a long, so b must too */ x = PyLong_AsLong((PyObject *)a); y = PyLong_AsLong((PyObject *)b); -#elif PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT +#elif LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT x = PyLong_AsLongLong((PyObject *)a); y = PyLong_AsLongLong((PyObject *)b); #else @@ -5039,7 +5039,7 @@ simple: } #if LONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLong(x); -#elif PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT +#elif LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT return PyLong_FromLongLong(x); #else # error "_PyLong_GCD" |