]> granicus.if.org Git - python/commitdiff
Now that we have standard (optional) long long support, the long long
authorGuido van Rossum <guido@python.org>
Mon, 31 Aug 1998 14:14:09 +0000 (14:14 +0000)
committerGuido van Rossum <guido@python.org>
Mon, 31 Aug 1998 14:14:09 +0000 (14:14 +0000)
support in this module can go.  The patch only deletes code
(PyLong_FromLongLong() and PyLong_AsLongLong()).  By Sjoerd Mullender.

Modules/almodule.c

index 7e399eac944e558c76555193480e41dd10788e27..ffd5a5632fc43da94d7e55b55f1a6bb8b276ba1d 100644 (file)
@@ -85,72 +85,6 @@ ErrorHandler(long code, const char *fmt, ...)
 
 #ifdef AL_NO_ELEM              /* IRIX 6 */
 
-static PyObject *
-PyLong_FromLongLong(long long v)
-{
-       /* XXXX Somewhat complicated way to convert a long long to a PyLong */
-       PyObject *l = NULL, *lhi, *llo;
-       int is_negative = 0;
-       static PyObject *i32;   /* 32 as a python long */
-
-       if (v < 0) {
-               is_negative = 1;
-               v = -v;
-       }
-       lhi = PyLong_FromUnsignedLong((unsigned long) ((unsigned long long) v >> 32));
-       llo = PyLong_FromUnsignedLong((unsigned long) (v & 0xFFFFFFFFLL));
-       if (i32 == NULL)
-               i32 = PyLong_FromLong(32L); /* don't decref */
-       if (PyErr_Occurred())
-               goto error;
-       if ((l = PyNumber_Lshift(lhi, i32)) == NULL)
-               goto error;
-       Py_DECREF(lhi);
-       lhi = l;
-       if ((l = PyNumber_Or(lhi, llo)) == NULL)
-               goto error;
-       Py_DECREF(lhi);
-       Py_DECREF(llo);
-       if (is_negative) {
-               if ((lhi = PyNumber_Negative(l)) == NULL)
-                       goto error;
-               Py_DECREF(l);
-               l = lhi;
-       }
-       return l;
-
-  error:
-       Py_XDECREF(lhi);
-       Py_XDECREF(llo);
-       Py_XDECREF(l);
-       return NULL;
-}
-
-static long long
-PyLong_AsLongLong(PyObject *v)
-{
-       /* XXXX Somewhat complicated way to convert a PyLong to a long long */
-       static PyObject *i2_32; /* 2**32 as a python long */
-       PyObject *lhi, *llo;
-       long long ihi;
-       unsigned long long ilo;
-
-       if (!PyLong_Check(v)) {
-               PyErr_BadInternalCall();
-               return -1;
-       }
-       if (i2_32 == NULL)
-               i2_32 = PyLong_FromLongLong(0x100000000LL); /* don't decref */
-       if ((v = PyNumber_Divmod(v, i2_32)) == NULL)
-               return -1;
-       lhi = PyTuple_GetItem(v, 0);
-       llo = PyTuple_GetItem(v, 1);
-       ihi = PyLong_AsLong(lhi);
-       ilo = PyLong_AsUnsignedLong(llo);
-       Py_DECREF(v);
-       return ihi * 0x100000000LL + ilo;
-}
-
 static PyObject *
 param2python(int resource, int param, ALvalue value, ALparamInfo *pinfo)
 {