replace PY_LONG_LONG with long long
diff --git a/Objects/longobject.c b/Objects/longobject.c
index 150953b..6c8fe22 100644
--- a/Objects/longobject.c
+++ b/Objects/longobject.c
@@ -993,9 +993,9 @@
#else
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
-# error "PyLong_FromVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
+# error "PyLong_FromVoidPtr: sizeof(long long) < sizeof(void*)"
#endif
- return PyLong_FromUnsignedLongLong((unsigned PY_LONG_LONG)(Py_uintptr_t)p);
+ return PyLong_FromUnsignedLongLong((unsigned long long)(Py_uintptr_t)p);
#endif /* SIZEOF_VOID_P <= SIZEOF_LONG */
}
@@ -1015,9 +1015,9 @@
#else
#if SIZEOF_LONG_LONG < SIZEOF_VOID_P
-# error "PyLong_AsVoidPtr: sizeof(PY_LONG_LONG) < sizeof(void*)"
+# error "PyLong_AsVoidPtr: sizeof(long long) < sizeof(void*)"
#endif
- PY_LONG_LONG x;
+ long long x;
if (PyLong_Check(vv) && _PyLong_Sign(vv) < 0)
x = PyLong_AsLongLong(vv);
@@ -1031,20 +1031,20 @@
return (void *)x;
}
-/* Initial PY_LONG_LONG support by Chris Herborth (chrish@qnx.com), later
+/* Initial long long support by Chris Herborth (chrish@qnx.com), later
* rewritten to use the newer PyLong_{As,From}ByteArray API.
*/
-#define PY_ABS_LLONG_MIN (0-(unsigned PY_LONG_LONG)PY_LLONG_MIN)
+#define PY_ABS_LLONG_MIN (0-(unsigned long long)PY_LLONG_MIN)
-/* Create a new int object from a C PY_LONG_LONG int. */
+/* Create a new int object from a C long long int. */
PyObject *
-PyLong_FromLongLong(PY_LONG_LONG ival)
+PyLong_FromLongLong(long long ival)
{
PyLongObject *v;
- unsigned PY_LONG_LONG abs_ival;
- unsigned PY_LONG_LONG t; /* unsigned so >> doesn't propagate sign bit */
+ unsigned long long abs_ival;
+ unsigned long long t; /* unsigned so >> doesn't propagate sign bit */
int ndigits = 0;
int negative = 0;
@@ -1052,11 +1052,11 @@
if (ival < 0) {
/* avoid signed overflow on negation; see comments
in PyLong_FromLong above. */
- abs_ival = (unsigned PY_LONG_LONG)(-1-ival) + 1;
+ abs_ival = (unsigned long long)(-1-ival) + 1;
negative = 1;
}
else {
- abs_ival = (unsigned PY_LONG_LONG)ival;
+ abs_ival = (unsigned long long)ival;
}
/* Count the number of Python digits.
@@ -1081,19 +1081,19 @@
return (PyObject *)v;
}
-/* Create a new int object from a C unsigned PY_LONG_LONG int. */
+/* Create a new int object from a C unsigned long long int. */
PyObject *
-PyLong_FromUnsignedLongLong(unsigned PY_LONG_LONG ival)
+PyLong_FromUnsignedLongLong(unsigned long long ival)
{
PyLongObject *v;
- unsigned PY_LONG_LONG t;
+ unsigned long long t;
int ndigits = 0;
if (ival < PyLong_BASE)
return PyLong_FromLong((long)ival);
/* Count the number of Python digits. */
- t = (unsigned PY_LONG_LONG)ival;
+ t = (unsigned long long)ival;
while (t) {
++ndigits;
t >>= PyLong_SHIFT;
@@ -1182,11 +1182,11 @@
/* Get a C long long int from an int object or any object that has an
__int__ method. Return -1 and set an error if overflow occurs. */
-PY_LONG_LONG
+long long
PyLong_AsLongLong(PyObject *vv)
{
PyLongObject *v;
- PY_LONG_LONG bytes;
+ long long bytes;
int res;
int do_decref = 0; /* if nb_int was called */
@@ -1224,30 +1224,30 @@
Py_DECREF(v);
}
- /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */
+ /* Plan 9 can't handle long long in ? : expressions */
if (res < 0)
- return (PY_LONG_LONG)-1;
+ return (long long)-1;
else
return bytes;
}
-/* Get a C unsigned PY_LONG_LONG int from an int object.
+/* Get a C unsigned long long int from an int object.
Return -1 and set an error if overflow occurs. */
-unsigned PY_LONG_LONG
+unsigned long long
PyLong_AsUnsignedLongLong(PyObject *vv)
{
PyLongObject *v;
- unsigned PY_LONG_LONG bytes;
+ unsigned long long bytes;
int res;
if (vv == NULL) {
PyErr_BadInternalCall();
- return (unsigned PY_LONG_LONG)-1;
+ return (unsigned long long)-1;
}
if (!PyLong_Check(vv)) {
PyErr_SetString(PyExc_TypeError, "an integer is required");
- return (unsigned PY_LONG_LONG)-1;
+ return (unsigned long long)-1;
}
v = (PyLongObject*)vv;
@@ -1259,9 +1259,9 @@
res = _PyLong_AsByteArray((PyLongObject *)vv, (unsigned char *)&bytes,
SIZEOF_LONG_LONG, PY_LITTLE_ENDIAN, 0);
- /* Plan 9 can't handle PY_LONG_LONG in ? : expressions */
+ /* Plan 9 can't handle long long in ? : expressions */
if (res < 0)
- return (unsigned PY_LONG_LONG)res;
+ return (unsigned long long)res;
else
return bytes;
}
@@ -1269,11 +1269,11 @@
/* Get a C unsigned long int from an int object, ignoring the high bits.
Returns -1 and sets an error condition if an error occurs. */
-static unsigned PY_LONG_LONG
+static unsigned long long
_PyLong_AsUnsignedLongLongMask(PyObject *vv)
{
PyLongObject *v;
- unsigned PY_LONG_LONG x;
+ unsigned long long x;
Py_ssize_t i;
int sign;
@@ -1299,11 +1299,11 @@
return x * sign;
}
-unsigned PY_LONG_LONG
+unsigned long long
PyLong_AsUnsignedLongLongMask(PyObject *op)
{
PyLongObject *lo;
- unsigned PY_LONG_LONG val;
+ unsigned long long val;
if (op == NULL) {
PyErr_BadInternalCall();
@@ -1316,7 +1316,7 @@
lo = _PyLong_FromNbInt(op);
if (lo == NULL)
- return (unsigned PY_LONG_LONG)-1;
+ return (unsigned long long)-1;
val = _PyLong_AsUnsignedLongLongMask((PyObject *)lo);
Py_DECREF(lo);
@@ -1333,13 +1333,13 @@
In this case *overflow will be 0.
*/
-PY_LONG_LONG
+long long
PyLong_AsLongLongAndOverflow(PyObject *vv, int *overflow)
{
/* This version by Tim Peters */
PyLongObject *v;
- unsigned PY_LONG_LONG x, prev;
- PY_LONG_LONG res;
+ unsigned long long x, prev;
+ long long res;
Py_ssize_t i;
int sign;
int do_decref = 0; /* if nb_int was called */
@@ -1391,8 +1391,8 @@
/* Haven't lost any bits, but casting to long requires extra
* care (see comment above).
*/
- if (x <= (unsigned PY_LONG_LONG)PY_LLONG_MAX) {
- res = (PY_LONG_LONG)x * sign;
+ if (x <= (unsigned long long)PY_LLONG_MAX) {
+ res = (long long)x * sign;
}
else if (sign < 0 && x == PY_ABS_LLONG_MIN) {
res = PY_LLONG_MIN;
@@ -3481,7 +3481,7 @@
/* fast path for single-digit multiplication */
if (Py_ABS(Py_SIZE(a)) <= 1 && Py_ABS(Py_SIZE(b)) <= 1) {
stwodigits v = (stwodigits)(MEDIUM_VALUE(a)) * MEDIUM_VALUE(b);
- return PyLong_FromLongLong((PY_LONG_LONG)v);
+ return PyLong_FromLongLong((long long)v);
}
z = k_mul(a, b);
@@ -4650,7 +4650,7 @@
/* a fits into a long, so b must too */
x = PyLong_AsLong((PyObject *)a);
y = PyLong_AsLong((PyObject *)b);
-#elif defined(PY_LONG_LONG) && PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT
+#elif defined(long long) && PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT
x = PyLong_AsLongLong((PyObject *)a);
y = PyLong_AsLongLong((PyObject *)b);
#else
@@ -4669,7 +4669,7 @@
}
#if LONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT
return PyLong_FromLong(x);
-#elif defined(PY_LONG_LONG) && PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT
+#elif defined(long long) && PY_LLONG_MAX >> PyLong_SHIFT >> PyLong_SHIFT
return PyLong_FromLongLong(x);
#else
# error "_PyLong_GCD"
diff --git a/Objects/memoryobject.c b/Objects/memoryobject.c
index adf3ec6..07402d2 100644
--- a/Objects/memoryobject.c
+++ b/Objects/memoryobject.c
@@ -1111,7 +1111,7 @@
case 'h': case 'H': size = sizeof(short); break;
case 'i': case 'I': size = sizeof(int); break;
case 'l': case 'L': size = sizeof(long); break;
- case 'q': case 'Q': size = sizeof(PY_LONG_LONG); break;
+ case 'q': case 'Q': size = sizeof(long long); break;
case 'n': case 'N': size = sizeof(Py_ssize_t); break;
case 'f': size = sizeof(float); break;
case 'd': size = sizeof(double); break;
@@ -1577,11 +1577,11 @@
return lu;
}
-static PY_LONG_LONG
+static long long
pylong_as_lld(PyObject *item)
{
PyObject *tmp;
- PY_LONG_LONG lld;
+ long long lld;
tmp = PyNumber_Index(item);
if (tmp == NULL)
@@ -1592,15 +1592,15 @@
return lld;
}
-static unsigned PY_LONG_LONG
+static unsigned long long
pylong_as_llu(PyObject *item)
{
PyObject *tmp;
- unsigned PY_LONG_LONG llu;
+ unsigned long long llu;
tmp = PyNumber_Index(item);
if (tmp == NULL)
- return (unsigned PY_LONG_LONG)-1;
+ return (unsigned long long)-1;
llu = PyLong_AsUnsignedLongLong(tmp);
Py_DECREF(tmp);
@@ -1653,10 +1653,10 @@
Py_LOCAL_INLINE(PyObject *)
unpack_single(const char *ptr, const char *fmt)
{
- unsigned PY_LONG_LONG llu;
+ unsigned long long llu;
unsigned long lu;
size_t zu;
- PY_LONG_LONG lld;
+ long long lld;
long ld;
Py_ssize_t zd;
double d;
@@ -1685,8 +1685,8 @@
case 'L': UNPACK_SINGLE(lu, ptr, unsigned long); goto convert_lu;
/* native 64-bit */
- case 'q': UNPACK_SINGLE(lld, ptr, PY_LONG_LONG); goto convert_lld;
- case 'Q': UNPACK_SINGLE(llu, ptr, unsigned PY_LONG_LONG); goto convert_llu;
+ case 'q': UNPACK_SINGLE(lld, ptr, long long); goto convert_lld;
+ case 'Q': UNPACK_SINGLE(llu, ptr, unsigned long long); goto convert_llu;
/* ssize_t and size_t */
case 'n': UNPACK_SINGLE(zd, ptr, Py_ssize_t); goto convert_zd;
@@ -1747,10 +1747,10 @@
static int
pack_single(char *ptr, PyObject *item, const char *fmt)
{
- unsigned PY_LONG_LONG llu;
+ unsigned long long llu;
unsigned long lu;
size_t zu;
- PY_LONG_LONG lld;
+ long long lld;
long ld;
Py_ssize_t zd;
double d;
@@ -1802,13 +1802,13 @@
lld = pylong_as_lld(item);
if (lld == -1 && PyErr_Occurred())
goto err_occurred;
- PACK_SINGLE(ptr, lld, PY_LONG_LONG);
+ PACK_SINGLE(ptr, lld, long long);
break;
case 'Q':
llu = pylong_as_llu(item);
- if (llu == (unsigned PY_LONG_LONG)-1 && PyErr_Occurred())
+ if (llu == (unsigned long long)-1 && PyErr_Occurred())
goto err_occurred;
- PACK_SINGLE(ptr, llu, unsigned PY_LONG_LONG);
+ PACK_SINGLE(ptr, llu, unsigned long long);
break;
/* ssize_t and size_t */
@@ -2646,8 +2646,8 @@
case 'L': CMP_SINGLE(p, q, unsigned long); return equal;
/* native 64-bit */
- case 'q': CMP_SINGLE(p, q, PY_LONG_LONG); return equal;
- case 'Q': CMP_SINGLE(p, q, unsigned PY_LONG_LONG); return equal;
+ case 'q': CMP_SINGLE(p, q, long long); return equal;
+ case 'Q': CMP_SINGLE(p, q, unsigned long long); return equal;
/* ssize_t and size_t */
case 'n': CMP_SINGLE(p, q, Py_ssize_t); return equal;
diff --git a/Objects/rangeobject.c b/Objects/rangeobject.c
index 284a100..8e74132 100644
--- a/Objects/rangeobject.c
+++ b/Objects/rangeobject.c
@@ -6,7 +6,7 @@
/* Support objects whose length is > PY_SSIZE_T_MAX.
This could be sped up for small PyLongs if they fit in a Py_ssize_t.
- This only matters on Win64. Though we could use PY_LONG_LONG which
+ This only matters on Win64. Though we could use long long which
would presumably help perf.
*/
diff --git a/Objects/unicodeobject.c b/Objects/unicodeobject.c
index 7ea1639..12d09f0 100644
--- a/Objects/unicodeobject.c
+++ b/Objects/unicodeobject.c
@@ -2680,7 +2680,7 @@
va_arg(*vargs, unsigned long));
else if (longlongflag)
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "u",
- va_arg(*vargs, unsigned PY_LONG_LONG));
+ va_arg(*vargs, unsigned long long));
else if (size_tflag)
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "u",
va_arg(*vargs, size_t));
@@ -2697,7 +2697,7 @@
va_arg(*vargs, long));
else if (longlongflag)
len = sprintf(buffer, "%" PY_FORMAT_LONG_LONG "i",
- va_arg(*vargs, PY_LONG_LONG));
+ va_arg(*vargs, long long));
else if (size_tflag)
len = sprintf(buffer, "%" PY_FORMAT_SIZE_T "i",
va_arg(*vargs, Py_ssize_t));