diff options
author | Guido van Rossum <guido@python.org> | 1998-08-31 14:14:09 (GMT) |
---|---|---|
committer | Guido van Rossum <guido@python.org> | 1998-08-31 14:14:09 (GMT) |
commit | 164543607cf8e854d1ba1c76eecd633aaf7ab377 (patch) | |
tree | eb9cc564fe821e79602f666c0e5b4f1dcab186e5 /Modules/almodule.c | |
parent | 80c7bcf667b49c9c62dffeb9e433613f2c94e87f (diff) | |
download | cpython-164543607cf8e854d1ba1c76eecd633aaf7ab377.zip cpython-164543607cf8e854d1ba1c76eecd633aaf7ab377.tar.gz cpython-164543607cf8e854d1ba1c76eecd633aaf7ab377.tar.bz2 |
Now that we have standard (optional) long long support, the long long
support in this module can go. The patch only deletes code
(PyLong_FromLongLong() and PyLong_AsLongLong()). By Sjoerd Mullender.
Diffstat (limited to 'Modules/almodule.c')
-rw-r--r-- | Modules/almodule.c | 66 |
1 files changed, 0 insertions, 66 deletions
diff --git a/Modules/almodule.c b/Modules/almodule.c index 7e399ea..ffd5a56 100644 --- a/Modules/almodule.c +++ b/Modules/almodule.c @@ -86,72 +86,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) { ALparamInfo info; |